diff --git a/app/models/channel/driver/mail_stdin.rb b/app/models/channel/driver/mail_stdin.rb index b6257b84a..e5e3354e4 100644 --- a/app/models/channel/driver/mail_stdin.rb +++ b/app/models/channel/driver/mail_stdin.rb @@ -10,11 +10,11 @@ process emails from STDIN e. g. - cat test/fixtures/mail1.box | rails r 'Channel::Driver::MailStdin.new' + cat test/data/mail/mail001.box | rails r 'Channel::Driver::MailStdin.new' e. g. if you want to trust on mail headers - cat test/fixtures/mail1.box | rails r 'Channel::Driver::MailStdin.new(trusted: true)' + cat test/data/mail/mail001.box | rails r 'Channel::Driver::MailStdin.new(trusted: true)' =end diff --git a/app/models/channel/email_parser.rb b/app/models/channel/email_parser.rb index bb1cb367e..97fb331f8 100644 --- a/app/models/channel/email_parser.rb +++ b/app/models/channel/email_parser.rb @@ -190,7 +190,7 @@ class Channel::EmailParser # get attachments mail.parts&.each do |part| - # protect process to work fine with spam emails, see test/fixtures/mail15.box + # protect process to work fine with spam emails, see test/data/mail/mail015.box begin attachs = _get_attachment(part, data[:attachments], mail) data[:attachments].concat(attachs) @@ -848,7 +848,7 @@ module Mail end end - # workaround to parse subjects with 2 different encodings correctly (e. g. quoted-printable see test/fixtures/mail9.box) + # workaround to parse subjects with 2 different encodings correctly (e. g. quoted-printable see test/data/mail/mail009.box) module Encodings def self.value_decode(str) # Optimization: If there's no encoded-words in the string, just return it @@ -884,7 +884,7 @@ module Mail end end - # issue#348 - IMAP mail fetching stops because of broken spam email (e. g. broken Content-Transfer-Encoding value see test/fixtures/mail43.box) + # issue#348 - IMAP mail fetching stops because of broken spam email (e. g. broken Content-Transfer-Encoding value see test/data/mail/mail043.box) # https://github.com/zammad/zammad/issues/348 class Body def decoded diff --git a/lib/core_ext/string.rb b/lib/core_ext/string.rb index f1c2efacd..dd522da16 100644 --- a/lib/core_ext/string.rb +++ b/lib/core_ext/string.rb @@ -111,7 +111,7 @@ class String string = "#{self}" # rubocop:disable Style/UnneededInterpolation # in case of invalid encoding, strip invalid chars - # see also test/fixtures/mail21.box + # see also test/data/mail/mail021.box # note: string.encode!('UTF-8', 'UTF-8', :invalid => :replace, :replace => '?') was not detecting invalid chars if !string.valid_encoding? string = string.chars.select(&:valid_encoding?).join diff --git a/lib/enrichment/clearbit/user.rb b/lib/enrichment/clearbit/user.rb index 6dff9d66e..e885f62d4 100644 --- a/lib/enrichment/clearbit/user.rb +++ b/lib/enrichment/clearbit/user.rb @@ -119,9 +119,9 @@ module Enrichment def fetch if !Rails.env.production? - filename = Rails.root.join('test', 'fixtures', 'clearbit', "#{@local_user.email}.json") + filename = Rails.root.join('test', 'data', 'clearbit', "#{@local_user.email}.json") if File.exist?(filename) - data = IO.binread(filename) + data = File.binread(filename) return JSON.parse(data) if data end end diff --git a/test/browser/agent_ticket_attachment_test.rb b/test/browser/agent_ticket_attachment_test.rb index 87aec7d59..20318e49d 100644 --- a/test/browser/agent_ticket_attachment_test.rb +++ b/test/browser/agent_ticket_attachment_test.rb @@ -45,7 +45,8 @@ class AgentTicketAttachmentTest < TestCase # add attachment, attachment check should quiet file_upload( css: '.content.active .attachmentPlaceholder-inputHolder input', - files: ['test/fixtures/upload2.jpg', 'test/fixtures/upload1.txt'], + files: [Rails.root.join('test', 'data', 'upload', 'upload1.txt'), + Rails.root.join('test', 'data', 'upload', 'upload2.jpg')], ) # submit form @@ -91,7 +92,7 @@ class AgentTicketAttachmentTest < TestCase # add attachment, attachment check should quiet file_upload( css: '.content.active .attachmentPlaceholder-inputHolder input', - files: ['test/fixtures/upload1.txt'], + files: [Rails.root.join('test', 'data', 'upload', 'upload1.txt')], ) # submit form @@ -132,7 +133,8 @@ class AgentTicketAttachmentTest < TestCase # add attachment without body file_upload( css: '.content.active .attachmentPlaceholder-inputHolder input', - files: ['test/fixtures/upload2.jpg', 'test/fixtures/upload1.txt'], + files: [Rails.root.join('test', 'data', 'upload', 'upload1.txt'), + Rails.root.join('test', 'data', 'upload', 'upload2.jpg')], ) # submit form diff --git a/test/browser_test_helper.rb b/test/browser_test_helper.rb index 50a77dff4..9b271e77b 100644 --- a/test/browser_test_helper.rb +++ b/test/browser_test_helper.rb @@ -1226,7 +1226,7 @@ set type of task (closeTab, closeNextInOverview, stayOnTab) file_upload( browser: browser1, css: '.content.active .attachmentPlaceholder-inputHolder input' - files: ['path/in/home/some_file.ext'], # 'test/fixtures/test1.pdf' + files: ['path/in/home/some_file.ext'], # 'test/data/pdf/test1.pdf' ) =end diff --git a/test/controllers/organization_controller_test.rb b/test/controllers/organization_controller_test.rb index 56d10490e..37c8ea27c 100644 --- a/test/controllers/organization_controller_test.rb +++ b/test/controllers/organization_controller_test.rb @@ -531,7 +531,8 @@ class OrganizationControllerTest < ActionDispatch::IntegrationTest credentials = ActionController::HttpAuthentication::Basic.encode_credentials('rest-admin@example.com', 'adminpw') # invalid file - csv_file = ::Rack::Test::UploadedFile.new(Rails.root.join('test', 'fixtures', 'csv', 'organization_simple_col_not_existing.csv'), 'text/csv') + csv_file_path = Rails.root.join('test', 'data', 'csv', 'organization_simple_col_not_existing.csv') + csv_file = ::Rack::Test::UploadedFile.new(csv_file_path, 'text/csv') post '/api/v1/organizations/import?try=true', params: { file: csv_file, col_sep: ';' }, headers: { 'Authorization' => credentials } assert_response(200) result = JSON.parse(@response.body) @@ -545,7 +546,8 @@ class OrganizationControllerTest < ActionDispatch::IntegrationTest assert_equal("Line 2: unknown attribute 'name2' for Organization.", result['errors'][1]) # valid file try - csv_file = ::Rack::Test::UploadedFile.new(Rails.root.join('test', 'fixtures', 'csv', 'organization_simple.csv'), 'text/csv') + csv_file_path = Rails.root.join('test', 'data', 'csv', 'organization_simple.csv') + csv_file = ::Rack::Test::UploadedFile.new(csv_file_path, 'text/csv') post '/api/v1/organizations/import?try=true', params: { file: csv_file, col_sep: ';' }, headers: { 'Authorization' => credentials } assert_response(200) result = JSON.parse(@response.body) @@ -559,7 +561,8 @@ class OrganizationControllerTest < ActionDispatch::IntegrationTest assert_nil(Organization.find_by(name: 'organization-member-import2')) # valid file - csv_file = ::Rack::Test::UploadedFile.new(Rails.root.join('test', 'fixtures', 'csv', 'organization_simple.csv'), 'text/csv') + csv_file_path = Rails.root.join('test', 'data', 'csv', 'organization_simple.csv') + csv_file = ::Rack::Test::UploadedFile.new(csv_file_path, 'text/csv') post '/api/v1/organizations/import', params: { file: csv_file, col_sep: ';' }, headers: { 'Authorization' => credentials } assert_response(200) result = JSON.parse(@response.body) diff --git a/test/controllers/text_module_controller_test.rb b/test/controllers/text_module_controller_test.rb index c028df4fa..d7d83f78c 100644 --- a/test/controllers/text_module_controller_test.rb +++ b/test/controllers/text_module_controller_test.rb @@ -101,7 +101,8 @@ class TextModuleControllerTest < ActionDispatch::IntegrationTest credentials = ActionController::HttpAuthentication::Basic.encode_credentials('rest-admin@example.com', 'adminpw') # invalid file - csv_file = ::Rack::Test::UploadedFile.new(Rails.root.join('test', 'fixtures', 'csv', 'text_module_simple_col_not_existing.csv'), 'text/csv') + csv_file_path = Rails.root.join('test', 'data', 'csv', 'text_module_simple_col_not_existing.csv') + csv_file = ::Rack::Test::UploadedFile.new(csv_file_path, 'text/csv') post '/api/v1/text_modules/import?try=true', params: { file: csv_file, col_sep: ';' }, headers: { 'Authorization' => credentials } assert_response(200) result = JSON.parse(@response.body) @@ -115,7 +116,8 @@ class TextModuleControllerTest < ActionDispatch::IntegrationTest assert_equal("Line 2: unknown attribute 'keywords2' for TextModule.", result['errors'][1]) # valid file try - csv_file = ::Rack::Test::UploadedFile.new(Rails.root.join('test', 'fixtures', 'csv', 'text_module_simple.csv'), 'text/csv') + csv_file_path = Rails.root.join('test', 'data', 'csv', 'text_module_simple.csv') + csv_file = ::Rack::Test::UploadedFile.new(csv_file_path, 'text/csv') post '/api/v1/text_modules/import?try=true', params: { file: csv_file, col_sep: ';' }, headers: { 'Authorization' => credentials } assert_response(200) result = JSON.parse(@response.body) @@ -129,7 +131,8 @@ class TextModuleControllerTest < ActionDispatch::IntegrationTest assert_nil(TextModule.find_by(name: 'some name2')) # valid file - csv_file = ::Rack::Test::UploadedFile.new(Rails.root.join('test', 'fixtures', 'csv', 'text_module_simple.csv'), 'text/csv') + csv_file_path = Rails.root.join('test', 'data', 'csv', 'text_module_simple.csv') + csv_file = ::Rack::Test::UploadedFile.new(csv_file_path, 'text/csv') post '/api/v1/text_modules/import', params: { file: csv_file, col_sep: ';' }, headers: { 'Authorization' => credentials } assert_response(200) result = JSON.parse(@response.body) diff --git a/test/controllers/ticket_article_attachments_controller_test.rb b/test/controllers/ticket_article_attachments_controller_test.rb index abee9e162..750728eb6 100644 --- a/test/controllers/ticket_article_attachments_controller_test.rb +++ b/test/controllers/ticket_article_attachments_controller_test.rb @@ -144,7 +144,8 @@ class TicketArticleAttachmentsControllerTest < ActionDispatch::IntegrationTest test '01.02 test attachments for split' do headers = { 'ACCEPT' => 'application/json', 'CONTENT_TYPE' => 'application/json' } - email_raw_string = IO.binread('test/fixtures/mail24.box') + email_file_path = Rails.root.join('test', 'data', 'mail', 'mail024.box') + email_raw_string = File.read(email_file_path) ticket_p, article_p, user_p = Channel::EmailParser.new.process({}, email_raw_string) credentials = ActionController::HttpAuthentication::Basic.encode_credentials('tickets-agent@example.com', 'agentpw') @@ -161,7 +162,8 @@ class TicketArticleAttachmentsControllerTest < ActionDispatch::IntegrationTest test '01.03 test attachments for forward' do headers = { 'ACCEPT' => 'application/json', 'CONTENT_TYPE' => 'application/json' } - email_raw_string = IO.binread('test/fixtures/mail8.box') + email_file_path = Rails.root.join('test', 'data', 'mail', 'mail008.box') + email_raw_string = File.read(email_file_path) ticket_p, article_p, user_p = Channel::EmailParser.new.process({}, email_raw_string) credentials = ActionController::HttpAuthentication::Basic.encode_credentials('tickets-agent@example.com', 'agentpw') @@ -177,7 +179,8 @@ class TicketArticleAttachmentsControllerTest < ActionDispatch::IntegrationTest assert_equal(result['attachments'].class, Array) assert(result['attachments'].blank?) - email_raw_string = IO.binread('test/fixtures/mail24.box') + email_file_path = Rails.root.join('test', 'data', 'mail', 'mail024.box') + email_raw_string = File.read(email_file_path) ticket_p, article_p, user_p = Channel::EmailParser.new.process({}, email_raw_string) post "/api/v1/ticket_attachment_upload_clone_by_article/#{article_p.id}", params: { form_id: '1234-2' }.to_json, headers: headers.merge('Authorization' => credentials) diff --git a/test/controllers/user_controller_test.rb b/test/controllers/user_controller_test.rb index eaed69625..fca67736c 100644 --- a/test/controllers/user_controller_test.rb +++ b/test/controllers/user_controller_test.rb @@ -978,7 +978,8 @@ class UserControllerTest < ActionDispatch::IntegrationTest credentials = ActionController::HttpAuthentication::Basic.encode_credentials('rest-admin@example.com', 'adminpw') # invalid file - csv_file = ::Rack::Test::UploadedFile.new(Rails.root.join('test', 'fixtures', 'csv', 'user_simple_col_not_existing.csv'), 'text/csv') + csv_file_path = Rails.root.join('test', 'data', 'csv', 'user_simple_col_not_existing.csv') + csv_file = ::Rack::Test::UploadedFile.new(csv_file_path, 'text/csv') post '/api/v1/users/import?try=true', params: { file: csv_file, col_sep: ';' }, headers: { 'Authorization' => credentials } assert_response(200) result = JSON.parse(@response.body) @@ -992,7 +993,8 @@ class UserControllerTest < ActionDispatch::IntegrationTest assert_equal("Line 2: unknown attribute 'firstname2' for User.", result['errors'][1]) # valid file try - csv_file = ::Rack::Test::UploadedFile.new(Rails.root.join('test', 'fixtures', 'csv', 'user_simple.csv'), 'text/csv') + csv_file_path = Rails.root.join('test', 'data', 'csv', 'user_simple.csv') + csv_file = ::Rack::Test::UploadedFile.new(csv_file_path, 'text/csv') post '/api/v1/users/import?try=true', params: { file: csv_file, col_sep: ';' }, headers: { 'Authorization' => credentials } assert_response(200) result = JSON.parse(@response.body) @@ -1006,7 +1008,8 @@ class UserControllerTest < ActionDispatch::IntegrationTest assert_nil(User.find_by(login: 'user-simple-import2')) # valid file - csv_file = ::Rack::Test::UploadedFile.new(Rails.root.join('test', 'fixtures', 'csv', 'user_simple.csv'), 'text/csv') + csv_file_path = Rails.root.join('test', 'data', 'csv', 'user_simple.csv') + csv_file = ::Rack::Test::UploadedFile.new(csv_file_path, 'text/csv') post '/api/v1/users/import', params: { file: csv_file, col_sep: ';' }, headers: { 'Authorization' => credentials } assert_response(200) result = JSON.parse(@response.body) diff --git a/test/fixtures/calendar1.ics b/test/data/calendar/calendar1.ics similarity index 100% rename from test/fixtures/calendar1.ics rename to test/data/calendar/calendar1.ics diff --git a/test/fixtures/calendar2.ics b/test/data/calendar/calendar2.ics similarity index 100% rename from test/fixtures/calendar2.ics rename to test/data/calendar/calendar2.ics diff --git a/test/fixtures/calendar3.ics b/test/data/calendar/calendar3.ics similarity index 100% rename from test/fixtures/calendar3.ics rename to test/data/calendar/calendar3.ics diff --git a/test/fixtures/clearbit/alex@alexmaccaw.com.json b/test/data/clearbit/alex@alexmaccaw.com.json similarity index 100% rename from test/fixtures/clearbit/alex@alexmaccaw.com.json rename to test/data/clearbit/alex@alexmaccaw.com.json diff --git a/test/fixtures/clearbit/me2@example.com.json b/test/data/clearbit/me2@example.com.json similarity index 100% rename from test/fixtures/clearbit/me2@example.com.json rename to test/data/clearbit/me2@example.com.json diff --git a/test/fixtures/clearbit/me@example.com.json b/test/data/clearbit/me@example.com.json similarity index 100% rename from test/fixtures/clearbit/me@example.com.json rename to test/data/clearbit/me@example.com.json diff --git a/test/fixtures/clearbit/testing3@znuny.com.json b/test/data/clearbit/testing3@znuny.com.json similarity index 100% rename from test/fixtures/clearbit/testing3@znuny.com.json rename to test/data/clearbit/testing3@znuny.com.json diff --git a/test/fixtures/clearbit/testing4@znuny.com.json b/test/data/clearbit/testing4@znuny.com.json similarity index 100% rename from test/fixtures/clearbit/testing4@znuny.com.json rename to test/data/clearbit/testing4@znuny.com.json diff --git a/test/fixtures/clearbit/testing5@znuny.com.json b/test/data/clearbit/testing5@znuny.com.json similarity index 100% rename from test/fixtures/clearbit/testing5@znuny.com.json rename to test/data/clearbit/testing5@znuny.com.json diff --git a/test/fixtures/clearbit/testing6@znuny.com.json b/test/data/clearbit/testing6@znuny.com.json similarity index 100% rename from test/fixtures/clearbit/testing6@znuny.com.json rename to test/data/clearbit/testing6@znuny.com.json diff --git a/test/fixtures/csv/organization_simple.csv b/test/data/csv/organization_simple.csv similarity index 100% rename from test/fixtures/csv/organization_simple.csv rename to test/data/csv/organization_simple.csv diff --git a/test/fixtures/csv/organization_simple_col_not_existing.csv b/test/data/csv/organization_simple_col_not_existing.csv similarity index 100% rename from test/fixtures/csv/organization_simple_col_not_existing.csv rename to test/data/csv/organization_simple_col_not_existing.csv diff --git a/test/fixtures/csv/text_module_simple.csv b/test/data/csv/text_module_simple.csv similarity index 100% rename from test/fixtures/csv/text_module_simple.csv rename to test/data/csv/text_module_simple.csv diff --git a/test/fixtures/csv/text_module_simple_col_not_existing.csv b/test/data/csv/text_module_simple_col_not_existing.csv similarity index 100% rename from test/fixtures/csv/text_module_simple_col_not_existing.csv rename to test/data/csv/text_module_simple_col_not_existing.csv diff --git a/test/fixtures/csv/user_simple.csv b/test/data/csv/user_simple.csv similarity index 100% rename from test/fixtures/csv/user_simple.csv rename to test/data/csv/user_simple.csv diff --git a/test/fixtures/csv/user_simple_col_not_existing.csv b/test/data/csv/user_simple_col_not_existing.csv similarity index 100% rename from test/fixtures/csv/user_simple_col_not_existing.csv rename to test/data/csv/user_simple_col_not_existing.csv diff --git a/test/fixtures/es-box1.box b/test/data/elasticsearch/es-box1.box similarity index 100% rename from test/fixtures/es-box1.box rename to test/data/elasticsearch/es-box1.box diff --git a/test/fixtures/es-normal.txt b/test/data/elasticsearch/es-normal.txt similarity index 100% rename from test/fixtures/es-normal.txt rename to test/data/elasticsearch/es-normal.txt diff --git a/test/fixtures/es-pdf1.pdf b/test/data/elasticsearch/es-pdf1.pdf similarity index 100% rename from test/fixtures/es-pdf1.pdf rename to test/data/elasticsearch/es-pdf1.pdf diff --git a/test/fixtures/es-too-big.txt b/test/data/elasticsearch/es-too-big.txt similarity index 100% rename from test/fixtures/es-too-big.txt rename to test/data/elasticsearch/es-too-big.txt diff --git a/test/fixtures/email_signature_detection/client_a_1.txt b/test/data/email_signature_detection/client_a_1.txt similarity index 100% rename from test/fixtures/email_signature_detection/client_a_1.txt rename to test/data/email_signature_detection/client_a_1.txt diff --git a/test/fixtures/email_signature_detection/client_a_2.txt b/test/data/email_signature_detection/client_a_2.txt similarity index 100% rename from test/fixtures/email_signature_detection/client_a_2.txt rename to test/data/email_signature_detection/client_a_2.txt diff --git a/test/fixtures/email_signature_detection/client_a_3.txt b/test/data/email_signature_detection/client_a_3.txt similarity index 100% rename from test/fixtures/email_signature_detection/client_a_3.txt rename to test/data/email_signature_detection/client_a_3.txt diff --git a/test/fixtures/email_signature_detection/client_b_1.txt b/test/data/email_signature_detection/client_b_1.txt similarity index 100% rename from test/fixtures/email_signature_detection/client_b_1.txt rename to test/data/email_signature_detection/client_b_1.txt diff --git a/test/fixtures/email_signature_detection/client_b_2.txt b/test/data/email_signature_detection/client_b_2.txt similarity index 100% rename from test/fixtures/email_signature_detection/client_b_2.txt rename to test/data/email_signature_detection/client_b_2.txt diff --git a/test/fixtures/email_signature_detection/client_b_3.txt b/test/data/email_signature_detection/client_b_3.txt similarity index 100% rename from test/fixtures/email_signature_detection/client_b_3.txt rename to test/data/email_signature_detection/client_b_3.txt diff --git a/test/fixtures/email_signature_detection/client_c_1.html b/test/data/email_signature_detection/client_c_1.html similarity index 100% rename from test/fixtures/email_signature_detection/client_c_1.html rename to test/data/email_signature_detection/client_c_1.html diff --git a/test/fixtures/email_signature_detection/client_c_2.html b/test/data/email_signature_detection/client_c_2.html similarity index 100% rename from test/fixtures/email_signature_detection/client_c_2.html rename to test/data/email_signature_detection/client_c_2.html diff --git a/test/fixtures/email_signature_detection/client_c_3.html b/test/data/email_signature_detection/client_c_3.html similarity index 100% rename from test/fixtures/email_signature_detection/client_c_3.html rename to test/data/email_signature_detection/client_c_3.html diff --git a/test/fixtures/email_signature_detection/example1.html b/test/data/email_signature_detection/example1.html similarity index 100% rename from test/fixtures/email_signature_detection/example1.html rename to test/data/email_signature_detection/example1.html diff --git a/test/fixtures/idoit/object_types_filter_response.json b/test/data/idoit/object_types_filter_response.json similarity index 100% rename from test/fixtures/idoit/object_types_filter_response.json rename to test/data/idoit/object_types_filter_response.json diff --git a/test/fixtures/idoit/object_types_response.json b/test/data/idoit/object_types_response.json similarity index 100% rename from test/fixtures/idoit/object_types_response.json rename to test/data/idoit/object_types_response.json diff --git a/test/fixtures/mail1.box b/test/data/mail/mail001.box similarity index 100% rename from test/fixtures/mail1.box rename to test/data/mail/mail001.box diff --git a/test/fixtures/mail2.box b/test/data/mail/mail002.box similarity index 100% rename from test/fixtures/mail2.box rename to test/data/mail/mail002.box diff --git a/test/fixtures/mail3.box b/test/data/mail/mail003.box similarity index 100% rename from test/fixtures/mail3.box rename to test/data/mail/mail003.box diff --git a/test/fixtures/mail4.box b/test/data/mail/mail004.box similarity index 100% rename from test/fixtures/mail4.box rename to test/data/mail/mail004.box diff --git a/test/fixtures/mail5.box b/test/data/mail/mail005.box similarity index 100% rename from test/fixtures/mail5.box rename to test/data/mail/mail005.box diff --git a/test/fixtures/mail6.box b/test/data/mail/mail006.box similarity index 100% rename from test/fixtures/mail6.box rename to test/data/mail/mail006.box diff --git a/test/fixtures/mail7.box b/test/data/mail/mail007.box similarity index 100% rename from test/fixtures/mail7.box rename to test/data/mail/mail007.box diff --git a/test/fixtures/mail8.box b/test/data/mail/mail008.box similarity index 100% rename from test/fixtures/mail8.box rename to test/data/mail/mail008.box diff --git a/test/fixtures/mail9.box b/test/data/mail/mail009.box similarity index 100% rename from test/fixtures/mail9.box rename to test/data/mail/mail009.box diff --git a/test/fixtures/mail10.box b/test/data/mail/mail010.box similarity index 100% rename from test/fixtures/mail10.box rename to test/data/mail/mail010.box diff --git a/test/fixtures/mail11.box b/test/data/mail/mail011.box similarity index 100% rename from test/fixtures/mail11.box rename to test/data/mail/mail011.box diff --git a/test/fixtures/mail12.box b/test/data/mail/mail012.box similarity index 100% rename from test/fixtures/mail12.box rename to test/data/mail/mail012.box diff --git a/test/fixtures/mail13.box b/test/data/mail/mail013.box similarity index 100% rename from test/fixtures/mail13.box rename to test/data/mail/mail013.box diff --git a/test/fixtures/mail14.box b/test/data/mail/mail014.box similarity index 100% rename from test/fixtures/mail14.box rename to test/data/mail/mail014.box diff --git a/test/fixtures/mail15.box b/test/data/mail/mail015.box similarity index 100% rename from test/fixtures/mail15.box rename to test/data/mail/mail015.box diff --git a/test/fixtures/mail16.box b/test/data/mail/mail016.box similarity index 100% rename from test/fixtures/mail16.box rename to test/data/mail/mail016.box diff --git a/test/fixtures/mail17.box b/test/data/mail/mail017.box similarity index 100% rename from test/fixtures/mail17.box rename to test/data/mail/mail017.box diff --git a/test/fixtures/mail18.box b/test/data/mail/mail018.box similarity index 100% rename from test/fixtures/mail18.box rename to test/data/mail/mail018.box diff --git a/test/fixtures/mail19.box b/test/data/mail/mail019.box similarity index 100% rename from test/fixtures/mail19.box rename to test/data/mail/mail019.box diff --git a/test/fixtures/mail20.box b/test/data/mail/mail020.box similarity index 100% rename from test/fixtures/mail20.box rename to test/data/mail/mail020.box diff --git a/test/fixtures/mail21.box b/test/data/mail/mail021.box similarity index 100% rename from test/fixtures/mail21.box rename to test/data/mail/mail021.box diff --git a/test/fixtures/mail22.box b/test/data/mail/mail022.box similarity index 100% rename from test/fixtures/mail22.box rename to test/data/mail/mail022.box diff --git a/test/fixtures/mail23.box b/test/data/mail/mail023.box similarity index 100% rename from test/fixtures/mail23.box rename to test/data/mail/mail023.box diff --git a/test/fixtures/mail24.box b/test/data/mail/mail024.box similarity index 100% rename from test/fixtures/mail24.box rename to test/data/mail/mail024.box diff --git a/test/fixtures/mail25.box b/test/data/mail/mail025.box similarity index 100% rename from test/fixtures/mail25.box rename to test/data/mail/mail025.box diff --git a/test/fixtures/mail26.box b/test/data/mail/mail026.box similarity index 100% rename from test/fixtures/mail26.box rename to test/data/mail/mail026.box diff --git a/test/fixtures/mail27.box b/test/data/mail/mail027.box similarity index 100% rename from test/fixtures/mail27.box rename to test/data/mail/mail027.box diff --git a/test/fixtures/mail28.box b/test/data/mail/mail028.box similarity index 100% rename from test/fixtures/mail28.box rename to test/data/mail/mail028.box diff --git a/test/fixtures/mail29.box b/test/data/mail/mail029.box similarity index 100% rename from test/fixtures/mail29.box rename to test/data/mail/mail029.box diff --git a/test/fixtures/mail30.box b/test/data/mail/mail030.box similarity index 100% rename from test/fixtures/mail30.box rename to test/data/mail/mail030.box diff --git a/test/fixtures/mail31.box b/test/data/mail/mail031.box similarity index 100% rename from test/fixtures/mail31.box rename to test/data/mail/mail031.box diff --git a/test/fixtures/mail32.box b/test/data/mail/mail032.box similarity index 100% rename from test/fixtures/mail32.box rename to test/data/mail/mail032.box diff --git a/test/fixtures/mail33-undelivered-mail-returned-to-sender.box b/test/data/mail/mail033-undelivered-mail-returned-to-sender.box similarity index 100% rename from test/fixtures/mail33-undelivered-mail-returned-to-sender.box rename to test/data/mail/mail033-undelivered-mail-returned-to-sender.box diff --git a/test/fixtures/mail34.box b/test/data/mail/mail034.box similarity index 100% rename from test/fixtures/mail34.box rename to test/data/mail/mail034.box diff --git a/test/fixtures/mail35.box b/test/data/mail/mail035.box similarity index 100% rename from test/fixtures/mail35.box rename to test/data/mail/mail035.box diff --git a/test/fixtures/mail36.box b/test/data/mail/mail036.box similarity index 100% rename from test/fixtures/mail36.box rename to test/data/mail/mail036.box diff --git a/test/fixtures/mail37.box b/test/data/mail/mail037.box similarity index 100% rename from test/fixtures/mail37.box rename to test/data/mail/mail037.box diff --git a/test/fixtures/mail38.box b/test/data/mail/mail038.box similarity index 100% rename from test/fixtures/mail38.box rename to test/data/mail/mail038.box diff --git a/test/fixtures/mail39.box b/test/data/mail/mail039.box similarity index 100% rename from test/fixtures/mail39.box rename to test/data/mail/mail039.box diff --git a/test/fixtures/mail40.box b/test/data/mail/mail040.box similarity index 100% rename from test/fixtures/mail40.box rename to test/data/mail/mail040.box diff --git a/test/fixtures/mail41.box b/test/data/mail/mail041.box similarity index 100% rename from test/fixtures/mail41.box rename to test/data/mail/mail041.box diff --git a/test/fixtures/mail42.box b/test/data/mail/mail042.box similarity index 100% rename from test/fixtures/mail42.box rename to test/data/mail/mail042.box diff --git a/test/fixtures/mail43.box b/test/data/mail/mail043.box similarity index 100% rename from test/fixtures/mail43.box rename to test/data/mail/mail043.box diff --git a/test/fixtures/mail44.box b/test/data/mail/mail044.box similarity index 100% rename from test/fixtures/mail44.box rename to test/data/mail/mail044.box diff --git a/test/fixtures/mail45.box b/test/data/mail/mail045.box similarity index 100% rename from test/fixtures/mail45.box rename to test/data/mail/mail045.box diff --git a/test/fixtures/mail46.box b/test/data/mail/mail046.box similarity index 100% rename from test/fixtures/mail46.box rename to test/data/mail/mail046.box diff --git a/test/fixtures/mail47.box b/test/data/mail/mail047.box similarity index 100% rename from test/fixtures/mail47.box rename to test/data/mail/mail047.box diff --git a/test/fixtures/mail48.box b/test/data/mail/mail048.box similarity index 100% rename from test/fixtures/mail48.box rename to test/data/mail/mail048.box diff --git a/test/fixtures/mail49.box b/test/data/mail/mail049.box similarity index 100% rename from test/fixtures/mail49.box rename to test/data/mail/mail049.box diff --git a/test/fixtures/mail50.box b/test/data/mail/mail050.box similarity index 100% rename from test/fixtures/mail50.box rename to test/data/mail/mail050.box diff --git a/test/fixtures/mail51.box b/test/data/mail/mail051.box similarity index 100% rename from test/fixtures/mail51.box rename to test/data/mail/mail051.box diff --git a/test/fixtures/mail52.box b/test/data/mail/mail052.box similarity index 100% rename from test/fixtures/mail52.box rename to test/data/mail/mail052.box diff --git a/test/fixtures/mail53.box b/test/data/mail/mail053.box similarity index 100% rename from test/fixtures/mail53.box rename to test/data/mail/mail053.box diff --git a/test/fixtures/mail54.box b/test/data/mail/mail054.box similarity index 100% rename from test/fixtures/mail54.box rename to test/data/mail/mail054.box diff --git a/test/fixtures/mail55.box b/test/data/mail/mail055.box similarity index 100% rename from test/fixtures/mail55.box rename to test/data/mail/mail055.box diff --git a/test/fixtures/mail56.box b/test/data/mail/mail056.box similarity index 100% rename from test/fixtures/mail56.box rename to test/data/mail/mail056.box diff --git a/test/fixtures/mail57.box b/test/data/mail/mail057.box similarity index 100% rename from test/fixtures/mail57.box rename to test/data/mail/mail057.box diff --git a/test/fixtures/mail58.box b/test/data/mail/mail058.box similarity index 100% rename from test/fixtures/mail58.box rename to test/data/mail/mail058.box diff --git a/test/fixtures/mail59.box b/test/data/mail/mail059.box similarity index 100% rename from test/fixtures/mail59.box rename to test/data/mail/mail059.box diff --git a/test/fixtures/mail60.box b/test/data/mail/mail060.box similarity index 100% rename from test/fixtures/mail60.box rename to test/data/mail/mail060.box diff --git a/test/fixtures/mail62.box b/test/data/mail/mail062.box similarity index 100% rename from test/fixtures/mail62.box rename to test/data/mail/mail062.box diff --git a/test/fixtures/mail63.box b/test/data/mail/mail063.box similarity index 100% rename from test/fixtures/mail63.box rename to test/data/mail/mail063.box diff --git a/test/fixtures/mail64.box b/test/data/mail/mail064.box similarity index 100% rename from test/fixtures/mail64.box rename to test/data/mail/mail064.box diff --git a/test/fixtures/mail65.box b/test/data/mail/mail065.box similarity index 100% rename from test/fixtures/mail65.box rename to test/data/mail/mail065.box diff --git a/test/fixtures/mail66.box b/test/data/mail/mail066.box similarity index 100% rename from test/fixtures/mail66.box rename to test/data/mail/mail066.box diff --git a/test/fixtures/test1.pdf b/test/data/pdf/test1.pdf similarity index 100% rename from test/fixtures/test1.pdf rename to test/data/pdf/test1.pdf diff --git a/test/fixtures/telegram/channel1_message_content1.json b/test/data/telegram/channel1_message_content1.json similarity index 100% rename from test/fixtures/telegram/channel1_message_content1.json rename to test/data/telegram/channel1_message_content1.json diff --git a/test/fixtures/telegram/channel1_message_content2.json b/test/data/telegram/channel1_message_content2.json similarity index 100% rename from test/fixtures/telegram/channel1_message_content2.json rename to test/data/telegram/channel1_message_content2.json diff --git a/test/fixtures/telegram/channel1_message_content3.json b/test/data/telegram/channel1_message_content3.json similarity index 100% rename from test/fixtures/telegram/channel1_message_content3.json rename to test/data/telegram/channel1_message_content3.json diff --git a/test/fixtures/telegram/channel1_message_content4.json b/test/data/telegram/channel1_message_content4.json similarity index 100% rename from test/fixtures/telegram/channel1_message_content4.json rename to test/data/telegram/channel1_message_content4.json diff --git a/test/fixtures/telegram/channel1_message_content5.json b/test/data/telegram/channel1_message_content5.json similarity index 100% rename from test/fixtures/telegram/channel1_message_content5.json rename to test/data/telegram/channel1_message_content5.json diff --git a/test/fixtures/telegram/channel2_message_content1.json b/test/data/telegram/channel2_message_content1.json similarity index 100% rename from test/fixtures/telegram/channel2_message_content1.json rename to test/data/telegram/channel2_message_content1.json diff --git a/test/fixtures/telegram/personal1_message_content1.json b/test/data/telegram/personal1_message_content1.json similarity index 100% rename from test/fixtures/telegram/personal1_message_content1.json rename to test/data/telegram/personal1_message_content1.json diff --git a/test/fixtures/telegram/personal1_message_content2.json b/test/data/telegram/personal1_message_content2.json similarity index 100% rename from test/fixtures/telegram/personal1_message_content2.json rename to test/data/telegram/personal1_message_content2.json diff --git a/test/fixtures/telegram/personal1_message_end.json b/test/data/telegram/personal1_message_end.json similarity index 100% rename from test/fixtures/telegram/personal1_message_end.json rename to test/data/telegram/personal1_message_end.json diff --git a/test/fixtures/telegram/personal1_message_start.json b/test/data/telegram/personal1_message_start.json similarity index 100% rename from test/fixtures/telegram/personal1_message_start.json rename to test/data/telegram/personal1_message_start.json diff --git a/test/fixtures/telegram/personal2_message_content1.json b/test/data/telegram/personal2_message_content1.json similarity index 100% rename from test/fixtures/telegram/personal2_message_content1.json rename to test/data/telegram/personal2_message_content1.json diff --git a/test/fixtures/telegram/personal2_message_content2.json b/test/data/telegram/personal2_message_content2.json similarity index 100% rename from test/fixtures/telegram/personal2_message_content2.json rename to test/data/telegram/personal2_message_content2.json diff --git a/test/fixtures/telegram/personal2_message_start.json b/test/data/telegram/personal2_message_start.json similarity index 100% rename from test/fixtures/telegram/personal2_message_start.json rename to test/data/telegram/personal2_message_start.json diff --git a/test/fixtures/telegram/personal3_message_content1.json b/test/data/telegram/personal3_message_content1.json similarity index 100% rename from test/fixtures/telegram/personal3_message_content1.json rename to test/data/telegram/personal3_message_content1.json diff --git a/test/fixtures/telegram/personal3_message_content2.json b/test/data/telegram/personal3_message_content2.json similarity index 100% rename from test/fixtures/telegram/personal3_message_content2.json rename to test/data/telegram/personal3_message_content2.json diff --git a/test/fixtures/telegram/personal3_message_content3.json b/test/data/telegram/personal3_message_content3.json similarity index 100% rename from test/fixtures/telegram/personal3_message_content3.json rename to test/data/telegram/personal3_message_content3.json diff --git a/test/fixtures/telegram/personal3_message_content4.json b/test/data/telegram/personal3_message_content4.json similarity index 100% rename from test/fixtures/telegram/personal3_message_content4.json rename to test/data/telegram/personal3_message_content4.json diff --git a/test/fixtures/telegram/personal3_message_content5.json b/test/data/telegram/personal3_message_content5.json similarity index 100% rename from test/fixtures/telegram/personal3_message_content5.json rename to test/data/telegram/personal3_message_content5.json diff --git a/test/fixtures/telegram/personal3_message_start.json b/test/data/telegram/personal3_message_start.json similarity index 100% rename from test/fixtures/telegram/personal3_message_start.json rename to test/data/telegram/personal3_message_start.json diff --git a/test/fixtures/telegram/personal4_message_content1.json b/test/data/telegram/personal4_message_content1.json similarity index 100% rename from test/fixtures/telegram/personal4_message_content1.json rename to test/data/telegram/personal4_message_content1.json diff --git a/test/fixtures/telegram/personal5_message_content1.json b/test/data/telegram/personal5_message_content1.json similarity index 100% rename from test/fixtures/telegram/personal5_message_content1.json rename to test/data/telegram/personal5_message_content1.json diff --git a/test/fixtures/telegram/personal5_message_content2.json b/test/data/telegram/personal5_message_content2.json similarity index 100% rename from test/fixtures/telegram/personal5_message_content2.json rename to test/data/telegram/personal5_message_content2.json diff --git a/test/fixtures/ticket_trigger/mail1.box b/test/data/ticket_trigger/mail1.box similarity index 100% rename from test/fixtures/ticket_trigger/mail1.box rename to test/data/ticket_trigger/mail1.box diff --git a/test/fixtures/ticket_trigger/mail2.box b/test/data/ticket_trigger/mail2.box similarity index 100% rename from test/fixtures/ticket_trigger/mail2.box rename to test/data/ticket_trigger/mail2.box diff --git a/test/fixtures/ticket_trigger/mail3.box b/test/data/ticket_trigger/mail3.box similarity index 100% rename from test/fixtures/ticket_trigger/mail3.box rename to test/data/ticket_trigger/mail3.box diff --git a/test/fixtures/upload1.txt b/test/data/upload/upload1.txt similarity index 100% rename from test/fixtures/upload1.txt rename to test/data/upload/upload1.txt diff --git a/test/fixtures/upload2.jpg b/test/data/upload/upload2.jpg similarity index 100% rename from test/fixtures/upload2.jpg rename to test/data/upload/upload2.jpg diff --git a/test/integration/elasticsearch_test.rb b/test/integration/elasticsearch_test.rb index ebd8eefe4..5411ddab4 100644 --- a/test/integration/elasticsearch_test.rb +++ b/test/integration/elasticsearch_test.rb @@ -140,7 +140,7 @@ class ElasticsearchTest < ActiveSupport::TestCase Store.add( object: 'Ticket::Article', o_id: article1.id, - data: IO.binread(Rails.root.join('test', 'fixtures', 'es-normal.txt')), + data: File.binread(Rails.root.join('test', 'data', 'elasticsearch', 'es-normal.txt')), filename: 'es-normal.txt', preferences: {}, created_by_id: 1, @@ -201,7 +201,7 @@ class ElasticsearchTest < ActiveSupport::TestCase Store.add( object: 'Ticket::Article', o_id: article1.id, - data: IO.binread(Rails.root.join('test', 'fixtures', 'es-normal.txt')), + data: File.binread(Rails.root.join('test', 'data', 'elasticsearch', 'es-normal.txt')), filename: 'es-normal.txt', preferences: {}, created_by_id: 1, @@ -212,7 +212,7 @@ class ElasticsearchTest < ActiveSupport::TestCase Store.add( object: 'Ticket::Article', o_id: article1.id, - data: IO.binread(Rails.root.join('test', 'fixtures', 'es-pdf1.pdf')), + data: File.binread(Rails.root.join('test', 'data', 'elasticsearch', 'es-pdf1.pdf')), filename: 'es-pdf1.pdf', preferences: {}, created_by_id: 1, @@ -223,7 +223,7 @@ class ElasticsearchTest < ActiveSupport::TestCase Store.add( object: 'Ticket::Article', o_id: article1.id, - data: IO.binread(Rails.root.join('test', 'fixtures', 'es-box1.box')), + data: File.binread(Rails.root.join('test', 'data', 'elasticsearch', 'es-box1.box')), filename: 'mail1.box', preferences: {}, created_by_id: 1, @@ -234,7 +234,7 @@ class ElasticsearchTest < ActiveSupport::TestCase Store.add( object: 'Ticket::Article', o_id: article1.id, - data: IO.binread(Rails.root.join('test', 'fixtures', 'es-too-big.txt')), + data: File.binread(Rails.root.join('test', 'data', 'elasticsearch', 'es-too-big.txt')), filename: 'es-too-big.txt', preferences: {}, created_by_id: 1, diff --git a/test/integration/idoit_controller_test.rb b/test/integration/idoit_controller_test.rb index a970abf31..abc208c1f 100644 --- a/test/integration/idoit_controller_test.rb +++ b/test/integration/idoit_controller_test.rb @@ -185,7 +185,7 @@ class IdoitControllerTest < ActionDispatch::IntegrationTest end def read_messaage(file) - File.read("test/fixtures/idoit/#{file}.json") + File.read(Rails.root.join('test', 'data', 'idoit', "#{file}.json")) end end diff --git a/test/integration/telegram_controller_test.rb b/test/integration/telegram_controller_test.rb index 1ab2c9370..e9a86cf5e 100644 --- a/test/integration/telegram_controller_test.rb +++ b/test/integration/telegram_controller_test.rb @@ -369,6 +369,6 @@ class TelegramControllerTest < ActionDispatch::IntegrationTest end def read_messaage(file) - File.read("test/fixtures/telegram/#{file}.json") + File.read(Rails.root.join('test', 'data', 'telegram', "#{file}.json")) end end diff --git a/test/unit/calendar_test.rb b/test/unit/calendar_test.rb index ac57ce9cf..8405f9435 100644 --- a/test/unit/calendar_test.rb +++ b/test/unit/calendar_test.rb @@ -111,7 +111,7 @@ class CalendarTest < ActiveSupport::TestCase fri: { '09:00' => '17:00' } }, default: true, - ical_url: 'test/fixtures/calendar1.ics', + ical_url: Rails.root.join('test', 'data', 'calendar', 'calendar1.ics'), updated_by_id: 1, created_by_id: 1, ) @@ -149,10 +149,10 @@ class CalendarTest < ActiveSupport::TestCase cache_key = "CalendarIcal::#{calendar1.id}" cache = Cache.get(cache_key) - calendar1.update_columns(ical_url: 'test/fixtures/calendar2.ics') + calendar1.update_columns(ical_url: Rails.root.join('test', 'data', 'calendar', 'calendar2.ics').to_s) cache_key = "CalendarIcal::#{calendar1.id}" cache = Cache.get(cache_key) - cache[:ical_url] = 'test/fixtures/calendar2.ics' + cache[:ical_url] = calendar1.ical_url Cache.write( cache_key, cache, @@ -213,7 +213,7 @@ class CalendarTest < ActiveSupport::TestCase fri: { '09:00' => '17:00' } }, default: true, - ical_url: 'test/fixtures/calendar3.ics', + ical_url: Rails.root.join('test', 'data', 'calendar', 'calendar3.ics'), updated_by_id: 1, created_by_id: 1, ) diff --git a/test/unit/email_parser_test.rb b/test/unit/email_parser_test.rb index 48168cfd4..86d899478 100644 --- a/test/unit/email_parser_test.rb +++ b/test/unit/email_parser_test.rb @@ -5,8 +5,8 @@ class EmailParserTest < ActiveSupport::TestCase test 'parse' do files = [ { - data: IO.read('test/fixtures/mail1.box'), - source: 'test/fixtures/mail1.box', + data: File.read(Rails.root.join('test', 'data', 'mail', 'mail001.box')), + source: Rails.root.join('test', 'data', 'mail', 'mail001.box'), body_md5: 'e5cf748bf60cbbf324ee20314750fdf7', params: { from: 'John.Smith@example.com', @@ -23,8 +23,8 @@ class EmailParserTest < ActiveSupport::TestCase }, }, { - data: IO.read('test/fixtures/mail2.box'), - source: 'test/fixtures/mail2.box', + data: File.read(Rails.root.join('test', 'data', 'mail', 'mail002.box')), + source: Rails.root.join('test', 'data', 'mail', 'mail002.box'), body_md5: '154c7d3ae7b94f99589df62882841b08', params: { from: 'Martin Edenhofer ', @@ -43,8 +43,8 @@ Old programmers never die. They just branch to a new address. }, }, { - data: IO.read('test/fixtures/mail3.box'), - source: 'test/fixtures/mail3.box', + data: File.read(Rails.root.join('test', 'data', 'mail', 'mail003.box')), + source: Rails.root.join('test', 'data', 'mail', 'mail003.box'), body_md5: '0b6eb998e8903ba69a3528dedb5a5476', params: { from: '"Günther John | Example GmbH" ', @@ -74,8 +74,8 @@ Old programmers never die. They just branch to a new address. }, }, { - data: IO.read('test/fixtures/mail4.box'), - source: 'test/fixtures/mail4.box', + data: File.read(Rails.root.join('test', 'data', 'mail', 'mail004.box')), + source: Rails.root.join('test', 'data', 'mail', 'mail004.box'), body_md5: '9fab9a0e8523011fde0f3ecd80f8d72c', params: { from: '"Günther Katja | Example GmbH" ', @@ -107,8 +107,8 @@ Liebe Grüße! }, }, { - data: IO.read('test/fixtures/mail5.box'), - source: 'test/fixtures/mail5.box', + data: File.read(Rails.root.join('test', 'data', 'mail', 'mail005.box')), + source: Rails.root.join('test', 'data', 'mail', 'mail005.box'), body_md5: 'f34033e9a34bb5367062dd5df21115df', params: { from: 'marc.smith@example.com (Marc Smith)', @@ -119,8 +119,8 @@ Liebe Grüße! }, }, { - data: IO.read('test/fixtures/mail6.box'), - source: 'test/fixtures/mail6.box', + data: File.read(Rails.root.join('test', 'data', 'mail', 'mail006.box')), + source: Rails.root.join('test', 'data', 'mail', 'mail006.box'), body_md5: '849105bdee623b4314b4c3daa2495471', params: { from: '"Hans BÄKOSchönland" ', @@ -134,8 +134,8 @@ Liebe Grüße! #

{ - data: IO.read('test/fixtures/mail7.box'), - source: 'test/fixtures/mail7.box', + data: File.read(Rails.root.join('test', 'data', 'mail', 'mail007.box')), + source: Rails.root.join('test', 'data', 'mail', 'mail007.box'), body_md5: 'b779b65c7d90aa5e350d37998a6c5fc6', params: { from: 'Eike.Ehringer@example.com', @@ -195,8 +195,8 @@ Managing Director: Martin Edenhofer }, }, { - data: IO.read('test/fixtures/mail8.box'), - source: 'test/fixtures/mail8.box', + data: File.read(Rails.root.join('test', 'data', 'mail', 'mail008.box')), + source: Rails.root.join('test', 'data', 'mail', 'mail008.box'), body_md5: 'd540b6f1a7b25468c1bc854ebc4c43fe', attachments: [ { @@ -278,8 +278,8 @@ Managing Director: Martin Edenhofer }, }, { - data: IO.read('test/fixtures/mail9.box'), - source: 'test/fixtures/mail9.box', + data: File.read(Rails.root.join('test', 'data', 'mail', 'mail009.box')), + source: Rails.root.join('test', 'data', 'mail', 'mail009.box'), body_md5: '64675a479f80a674eb7c08e385c3622a', attachments: [ { @@ -304,8 +304,8 @@ Managing Director: Martin Edenhofer }, }, { - data: IO.read('test/fixtures/mail10.box'), - source: 'test/fixtures/mail10.box', + data: File.read(Rails.root.join('test', 'data', 'mail', 'mail010.box')), + source: Rails.root.join('test', 'data', 'mail', 'mail010.box'), body_md5: '47d41fa38028d5fb02c7d041da60ba1f', attachments: [ { @@ -329,8 +329,8 @@ Managing Director: Martin Edenhofer }, }, { - data: IO.read('test/fixtures/mail11.box'), - source: 'test/fixtures/mail11.box', + data: File.read(Rails.root.join('test', 'data', 'mail', 'mail011.box')), + source: Rails.root.join('test', 'data', 'mail', 'mail011.box'), body_md5: '260a815b0a7897e4219d210010008202', attachments: [ { @@ -380,8 +380,8 @@ Managing Director: Martin Edenhofer }, }, { - data: IO.read('test/fixtures/mail12.box'), - source: 'test/fixtures/mail12.box', + data: File.read(Rails.root.join('test', 'data', 'mail', 'mail012.box')), + source: Rails.root.join('test', 'data', 'mail', 'mail012.box'), body_md5: 'dd7e002b6bb709effb56bdb6f2cc2e32', attachments: [ { @@ -411,8 +411,8 @@ Managing Director: Martin Edenhofer }, }, { - data: IO.read('test/fixtures/mail13.box'), - source: 'test/fixtures/mail13.box', + data: File.read(Rails.root.join('test', 'data', 'mail', 'mail013.box')), + source: Rails.root.join('test', 'data', 'mail', 'mail013.box'), body_md5: 'c3b62f742eb702910d0074e438b34c72', attachments: [ { @@ -431,8 +431,8 @@ Managing Director: Martin Edenhofer }, }, { - data: IO.read('test/fixtures/mail14.box'), - source: 'test/fixtures/mail14.box', + data: File.read(Rails.root.join('test', 'data', 'mail', 'mail014.box')), + source: Rails.root.join('test', 'data', 'mail', 'mail014.box'), body_md5: '154c7d3ae7b94f99589df62882841b08', attachments: [ { @@ -456,8 +456,8 @@ Managing Director: Martin Edenhofer }, # spam email { - data: IO.read('test/fixtures/mail15.box'), - source: 'test/fixtures/mail15.box', + data: File.read(Rails.root.join('test', 'data', 'mail', 'mail015.box')), + source: Rails.root.join('test', 'data', 'mail', 'mail015.box'), body_md5: '5872ddcdfdf6bfe40f36cd0408fca667', attachments: [ # :preferences=>{"Message-ID"=>"", "Content-Type"=>"application/octet-stream; name=\"\xBC\xA8\xD0\xA7\xB9\xDC\xC0\xED,\xBE\xBF\xBE\xB9\xCB\xAD\xB4\xED\xC1\xCB.xls\"", "Mime-Type"=>"application/octet-stream", "Charset"=>"UTF-8"}} @@ -478,8 +478,8 @@ Managing Director: Martin Edenhofer }, # spam email { - data: IO.read('test/fixtures/mail16.box'), - source: 'test/fixtures/mail16.box', + data: File.read(Rails.root.join('test', 'data', 'mail', 'mail016.box')), + source: Rails.root.join('test', 'data', 'mail', 'mail016.box'), body_md5: 'c3ea8fde251062d56b7fc72b6d73d702', params: { from: nil, @@ -491,8 +491,8 @@ Managing Director: Martin Edenhofer }, # spam email { - data: IO.read('test/fixtures/mail17.box'), - source: 'test/fixtures/mail17.box', + data: File.read(Rails.root.join('test', 'data', 'mail', 'mail017.box')), + source: Rails.root.join('test', 'data', 'mail', 'mail017.box'), body_md5: 'd78731371e3ec120896c51be3d0d3f8e', params: { from: '"都琹" ', @@ -503,8 +503,8 @@ Managing Director: Martin Edenhofer }, }, { - data: IO.read('test/fixtures/mail18.box'), - source: 'test/fixtures/mail18.box', + data: File.read(Rails.root.join('test', 'data', 'mail', 'mail018.box')), + source: Rails.root.join('test', 'data', 'mail', 'mail018.box'), body_md5: '66f20e8557095762ccad9a6cb6f59c3a', params: { from: 'postmaster@example.com', @@ -515,8 +515,8 @@ Managing Director: Martin Edenhofer }, }, { - data: IO.read('test/fixtures/mail19.box'), - source: 'test/fixtures/mail19.box', + data: File.read(Rails.root.join('test', 'data', 'mail', 'mail019.box')), + source: Rails.root.join('test', 'data', 'mail', 'mail019.box'), body_md5: '6021dd92d8e7844e6bb9b5bb7a4adfb8', params: { from: '"我" <>', @@ -527,8 +527,8 @@ Managing Director: Martin Edenhofer }, }, { - data: IO.read('test/fixtures/mail20.box'), - source: 'test/fixtures/mail20.box', + data: File.read(Rails.root.join('test', 'data', 'mail', 'mail020.box')), + source: Rails.root.join('test', 'data', 'mail', 'mail020.box'), body_md5: '56ad8d02f4c7641fd2bb8ebf484d36d7', params: { from: 'Health and Care-Mall ', @@ -617,8 +617,8 @@ Managing Director: Martin Edenhofer }, }, { - data: IO.read('test/fixtures/mail21.box'), - source: 'test/fixtures/mail21.box', + data: File.read(Rails.root.join('test', 'data', 'mail', 'mail021.box')), + source: Rails.root.join('test', 'data', 'mail', 'mail021.box'), body_md5: 'dea7a8979172261f61fb799b6c83742e', params: { from: 'Viagra Super Force Online ', @@ -629,8 +629,8 @@ Managing Director: Martin Edenhofer }, }, { - data: IO.read('test/fixtures/mail22.box'), - source: 'test/fixtures/mail22.box', + data: File.read(Rails.root.join('test', 'data', 'mail', 'mail022.box')), + source: Rails.root.join('test', 'data', 'mail', 'mail022.box'), body_md5: '1af1f68f66713b63ce8ec4cc20c7887e', params: { from: 'Gilbertina Suthar ', @@ -642,8 +642,8 @@ Managing Director: Martin Edenhofer }, }, { - data: IO.read('test/fixtures/mail23.box'), - source: 'test/fixtures/mail23.box', + data: File.read(Rails.root.join('test', 'data', 'mail', 'mail023.box')), + source: Rails.root.join('test', 'data', 'mail', 'mail023.box'), body_md5: '23967dfbbc2e167332b2ecb78fb9e397', params: { from: 'marketingmanager@nthcpghana.com', @@ -654,8 +654,8 @@ Managing Director: Martin Edenhofer }, }, { - data: IO.read('test/fixtures/mail24.box'), - source: 'test/fixtures/mail24.box', + data: File.read(Rails.root.join('test', 'data', 'mail', 'mail024.box')), + source: Rails.root.join('test', 'data', 'mail', 'mail024.box'), body_md5: '5872ddcdfdf6bfe40f36cd0408fca667', params: { from: 'oracle@IG0-1-DB01.example.com', @@ -676,8 +676,8 @@ Managing Director: Martin Edenhofer ], }, { - data: IO.read('test/fixtures/mail25.box'), - source: 'test/fixtures/mail25.box', + data: File.read(Rails.root.join('test', 'data', 'mail', 'mail025.box')), + source: Rails.root.join('test', 'data', 'mail', 'mail025.box'), body_md5: '436f71d8d8a4ffbd3f18fc9de7d7f767', params: { from: 'oracle@IG0-1-DB01.example.com', @@ -695,8 +695,8 @@ end }, }, { - data: IO.read('test/fixtures/mail26.box'), - source: 'test/fixtures/mail26.box', + data: File.read(Rails.root.join('test', 'data', 'mail', 'mail026.box')), + source: Rails.root.join('test', 'data', 'mail', 'mail026.box'), body_md5: '48c2843d219a7430bc84533d67719e95', params: { from: 'gate ', @@ -722,8 +722,8 @@ end ], }, { - data: IO.read('test/fixtures/mail27.box'), - source: 'test/fixtures/mail27.box', + data: File.read(Rails.root.join('test', 'data', 'mail', 'mail027.box')), + source: Rails.root.join('test', 'data', 'mail', 'mail027.box'), body_md5: '5872ddcdfdf6bfe40f36cd0408fca667', params: { from: 'caoyaoewfzfw@21cn.com', @@ -741,8 +741,8 @@ end ], }, { - data: IO.read('test/fixtures/mail28.box'), - source: 'test/fixtures/mail28.box', + data: File.read(Rails.root.join('test', 'data', 'mail', 'mail028.box')), + source: Rails.root.join('test', 'data', 'mail', 'mail028.box'), body_md5: '5872ddcdfdf6bfe40f36cd0408fca667', params: { from: 'kontakt@example.de', @@ -764,8 +764,8 @@ end ], }, { - data: IO.read('test/fixtures/mail29.box'), - source: 'test/fixtures/mail29.box', + data: File.read(Rails.root.join('test', 'data', 'mail', 'mail029.box')), + source: Rails.root.join('test', 'data', 'mail', 'mail029.box'), body_md5: '0637f48a0979e479efec07120a2bb700', params: { from: 'Example Sales ', @@ -779,8 +779,8 @@ end }, }, { - data: IO.read('test/fixtures/mail30.box'), - source: 'test/fixtures/mail30.box', + data: File.read(Rails.root.join('test', 'data', 'mail', 'mail030.box')), + source: Rails.root.join('test', 'data', 'mail', 'mail030.box'), body_md5: '9ce35920f5702a871f227cfe7ddd3d65', params: { from: 'Manfred Haert ', @@ -792,8 +792,8 @@ end }, }, { - data: IO.read('test/fixtures/mail31.box'), - source: 'test/fixtures/mail31.box', + data: File.read(Rails.root.join('test', 'data', 'mail', 'mail031.box')), + source: Rails.root.join('test', 'data', 'mail', 'mail031.box'), body_md5: 'd5448d34bf7f5db0a525fc83735dc11b', params: { from: '"bertha mou" ', @@ -804,8 +804,8 @@ end }, }, { - data: IO.read('test/fixtures/mail32.box'), - source: 'test/fixtures/mail32.box', + data: File.read(Rails.root.join('test', 'data', 'mail', 'mail032.box')), + source: Rails.root.join('test', 'data', 'mail', 'mail032.box'), body_md5: '9ccf94a31ace1c27e71138c3803ff178', params: { from: '"Dana.Qin" ', @@ -816,8 +816,8 @@ end }, }, { - data: IO.read('test/fixtures/mail34.box'), - source: 'test/fixtures/mail34.box', + data: File.read(Rails.root.join('test', 'data', 'mail', 'mail034.box')), + source: Rails.root.join('test', 'data', 'mail', 'mail034.box'), body_md5: 'b855b615a2c9568ea7708f9dee6b6230', params: { from: 'Bay ', @@ -829,8 +829,8 @@ end }, }, { - data: IO.read('test/fixtures/mail36.box'), - source: 'test/fixtures/mail36.box', + data: File.read(Rails.root.join('test', 'data', 'mail', 'mail036.box')), + source: Rails.root.join('test', 'data', 'mail', 'mail036.box'), body_md5: '3c58aeb003a55cafb0893d69676b4316', params: { from: 'Martin Smith ', @@ -855,8 +855,8 @@ end }, }, { - data: IO.read('test/fixtures/mail37.box'), - source: 'test/fixtures/mail37.box', + data: File.read(Rails.root.join('test', 'data', 'mail', 'mail037.box')), + source: Rails.root.join('test', 'data', 'mail', 'mail037.box'), body_md5: 'dd67e5037a740c053c2bf91f67be072f', params: { from: 'Example ', @@ -869,8 +869,8 @@ end }, }, { - data: IO.read('test/fixtures/mail38.box'), - source: 'test/fixtures/mail38.box', + data: File.read(Rails.root.join('test', 'data', 'mail', 'mail038.box')), + source: Rails.root.join('test', 'data', 'mail', 'mail038.box'), body_md5: 'dcd25707eed638ea568644b206a8596e', params: { from: 'Martin Edenhofer ', @@ -889,8 +889,8 @@ end ], }, { - data: IO.read('test/fixtures/mail39.box'), - source: 'test/fixtures/mail39.box', + data: File.read(Rails.root.join('test', 'data', 'mail', 'mail039.box')), + source: Rails.root.join('test', 'data', 'mail', 'mail039.box'), body_md5: '92553234f01a918314f40973dfc2a303', params: { from: 'Martin Edenhofer ', @@ -919,8 +919,8 @@ end ], }, { - data: IO.read('test/fixtures/mail40.box'), - source: 'test/fixtures/mail40.box', + data: File.read(Rails.root.join('test', 'data', 'mail', 'mail040.box')), + source: Rails.root.join('test', 'data', 'mail', 'mail040.box'), body_md5: '5db91cb79f889f80bbf8b47ad98efac9', params: { from: 'Martin Edenhofer ', @@ -939,8 +939,8 @@ end ], }, { - data: IO.read('test/fixtures/mail41.box'), - source: 'test/fixtures/mail41.box', + data: File.read(Rails.root.join('test', 'data', 'mail', 'mail041.box')), + source: Rails.root.join('test', 'data', 'mail', 'mail041.box'), body_md5: '5872ddcdfdf6bfe40f36cd0408fca667', params: { from: 'Martin Edenhofer ', @@ -959,8 +959,8 @@ end ], }, { - data: IO.read('test/fixtures/mail42.box'), - source: 'test/fixtures/mail42.box', + data: File.read(Rails.root.join('test', 'data', 'mail', 'mail042.box')), + source: Rails.root.join('test', 'data', 'mail', 'mail042.box'), body_md5: '5872ddcdfdf6bfe40f36cd0408fca667', params: { from: 'Martin Edenhofer ', @@ -979,8 +979,8 @@ end ], }, { - data: IO.read('test/fixtures/mail43.box'), - source: 'test/fixtures/mail43.box', + data: File.read(Rails.root.join('test', 'data', 'mail', 'mail043.box')), + source: Rails.root.join('test', 'data', 'mail', 'mail043.box'), body_md5: 'a3b91a8969b54a67dd2154e70f74cc30', params: { from: 'Paula ', @@ -1034,8 +1034,8 @@ end }, }, { - data: IO.read('test/fixtures/mail44.box'), - source: 'test/fixtures/mail44.box', + data: File.read(Rails.root.join('test', 'data', 'mail', 'mail044.box')), + source: Rails.root.join('test', 'data', 'mail', 'mail044.box'), body_md5: 'ee930244edd3b7c19494e688aa9cc41c', params: { from: '"Clement.Si" ', @@ -1047,8 +1047,8 @@ end }, }, { - data: IO.read('test/fixtures/mail45.box'), - source: 'test/fixtures/mail45.box', + data: File.read(Rails.root.join('test', 'data', 'mail', 'mail045.box')), + source: Rails.root.join('test', 'data', 'mail', 'mail045.box'), body_md5: '1d847e3626145a9e886914ecf0d89368', params: { from: '"Ups Rémi" ', @@ -1060,8 +1060,8 @@ end }, }, { - data: IO.read('test/fixtures/mail48.box'), - source: 'test/fixtures/mail48.box', + data: File.read(Rails.root.join('test', 'data', 'mail', 'mail048.box')), + source: Rails.root.join('test', 'data', 'mail', 'mail048.box'), body_md5: '64675a479f80a674eb7c08e385c3622a', attachments: [ { @@ -1086,8 +1086,8 @@ end }, }, { - data: IO.read('test/fixtures/mail50.box'), - source: 'test/fixtures/mail50.box', + data: File.read(Rails.root.join('test', 'data', 'mail', 'mail050.box')), + source: Rails.root.join('test', 'data', 'mail', 'mail050.box'), body_md5: '154c7d3ae7b94f99589df62882841b08', attachments: [], params: { @@ -1095,8 +1095,8 @@ end }, }, { - data: IO.read('test/fixtures/mail51.box'), - source: 'test/fixtures/mail51.box', + data: File.read(Rails.root.join('test', 'data', 'mail', 'mail051.box')), + source: Rails.root.join('test', 'data', 'mail', 'mail051.box'), body_md5: '64675a479f80a674eb7c08e385c3622a', attachments: [ { @@ -1117,8 +1117,8 @@ end }, }, { - data: IO.read('test/fixtures/mail52.box'), - source: 'test/fixtures/mail52.box', + data: File.read(Rails.root.join('test', 'data', 'mail', 'mail052.box')), + source: Rails.root.join('test', 'data', 'mail', 'mail052.box'), body_md5: 'ad0c0727cd7d023ec9065daea03335f7', params: { from: 'MAILER-DAEMON@example.com (Mail Delivery System)', @@ -1128,8 +1128,8 @@ end }, }, { - data: IO.read('test/fixtures/mail53.box'), - source: 'test/fixtures/mail53.box', + data: File.read(Rails.root.join('test', 'data', 'mail', 'mail053.box')), + source: Rails.root.join('test', 'data', 'mail', 'mail053.box'), body_md5: '104da300f70d5683f007951c9780c83d', params: { from: 'MAILER-DAEMON (Mail Delivery System)', @@ -1139,8 +1139,8 @@ end }, }, { - data: IO.read('test/fixtures/mail54.box'), - source: 'test/fixtures/mail54.box', + data: File.read(Rails.root.join('test', 'data', 'mail', 'mail054.box')), + source: Rails.root.join('test', 'data', 'mail', 'mail054.box'), body_md5: '5872ddcdfdf6bfe40f36cd0408fca667', params: { from: '"Smith, Karoline, Example DE" ', @@ -1151,8 +1151,8 @@ end }, }, { - data: IO.read('test/fixtures/mail56.box'), - source: 'test/fixtures/mail56.box', + data: File.read(Rails.root.join('test', 'data', 'mail', 'mail056.box')), + source: Rails.root.join('test', 'data', 'mail', 'mail056.box'), body_md5: 'ee40e852b9fa18652ea66e2eda1ecbd3', attachments: [ { @@ -1174,8 +1174,8 @@ end }, }, { - data: IO.read('test/fixtures/mail57.box'), - source: 'test/fixtures/mail57.box', + data: File.read(Rails.root.join('test', 'data', 'mail', 'mail057.box')), + source: Rails.root.join('test', 'data', 'mail', 'mail057.box'), body_md5: '3c5e4cf2d2a9bc572f10cd6222556027', attachments: [ { @@ -1211,8 +1211,8 @@ Bob Smith }, }, { - data: IO.read('test/fixtures/mail58.box'), - source: 'test/fixtures/mail58.box', + data: File.read(Rails.root.join('test', 'data', 'mail', 'mail058.box')), + source: Rails.root.join('test', 'data', 'mail', 'mail058.box'), body_md5: '548917e0bff0806f9b27c09bbf23bb38', params: { from: 'Yangzhou ABC Lighting Equipment , LTD ', @@ -1229,8 +1229,8 @@ Old programmers never die. They just branch to a new address." }, }, { - data: IO.read('test/fixtures/mail59.box'), - source: 'test/fixtures/mail59.box', + data: File.read(Rails.root.join('test', 'data', 'mail', 'mail059.box')), + source: Rails.root.join('test', 'data', 'mail', 'mail059.box'), body_md5: '548917e0bff0806f9b27c09bbf23bb38', params: { from: '"Yangzhou ABC Lighting Equipment " <>, "LTD" ', @@ -1247,8 +1247,8 @@ Old programmers never die. They just branch to a new address." }, }, { - data: IO.read('test/fixtures/mail62.box'), - source: 'test/fixtures/mail62.box', + data: File.read(Rails.root.join('test', 'data', 'mail', 'mail062.box')), + source: Rails.root.join('test', 'data', 'mail', 'mail062.box'), body_md5: '10e7158e65a12b5850163d4d4b8ca2f8', attachments: [ { @@ -1305,8 +1305,8 @@ Old programmers never die. They just branch to a new address." }, }, { - data: IO.read('test/fixtures/mail63.box'), - source: 'test/fixtures/mail63.box', + data: File.read(Rails.root.join('test', 'data', 'mail', 'mail063.box')), + source: Rails.root.join('test', 'data', 'mail', 'mail063.box'), body_md5: 'dbed0b09656d17bf4e832b2c18381c24', attachments: [ { @@ -1341,8 +1341,8 @@ delete your own text from the attached returned message. }, }, { - data: IO.read('test/fixtures/mail66.box'), - source: 'test/fixtures/mail66.box', + data: File.read(Rails.root.join('test', 'data', 'mail', 'mail066.box')), + source: Rails.root.join('test', 'data', 'mail', 'mail066.box'), body_md5: '346effdbc86ef1f5ea263102fba2e542', attachments: [ { diff --git a/test/unit/email_process_bounce_delivery_permanent_failed_test.rb b/test/unit/email_process_bounce_delivery_permanent_failed_test.rb index 98701ab08..3bf543dff 100644 --- a/test/unit/email_process_bounce_delivery_permanent_failed_test.rb +++ b/test/unit/email_process_bounce_delivery_permanent_failed_test.rb @@ -100,7 +100,7 @@ class EmailProcessBounceDeliveryPermanentFailedTest < ActiveSupport::TestCase assert_equal(4, ticket.articles.count) travel 1.second - email_raw_string = IO.binread('test/fixtures/mail33-undelivered-mail-returned-to-sender.box') + email_raw_string = File.read(Rails.root.join('test', 'data', 'mail', 'mail033-undelivered-mail-returned-to-sender.box')) ticket_p, article_p, user_p = Channel::EmailParser.new.process({}, email_raw_string) assert_equal(ticket.id, ticket_p.id) assert_equal('open', ticket_p.state.name) @@ -207,7 +207,7 @@ class EmailProcessBounceDeliveryPermanentFailedTest < ActiveSupport::TestCase assert_equal(4, ticket.articles.count) travel 1.second - email_raw_string = IO.binread('test/fixtures/mail55.box') + email_raw_string = File.read(Rails.root.join('test', 'data', 'mail', 'mail055.box')) ticket_p, article_p, user_p = Channel::EmailParser.new.process({}, email_raw_string) assert_equal(ticket.id, ticket_p.id) assert_equal('open', ticket_p.state.name) diff --git a/test/unit/email_process_bounce_follow_test.rb b/test/unit/email_process_bounce_follow_test.rb index 967e1cf03..9e6045ec2 100644 --- a/test/unit/email_process_bounce_follow_test.rb +++ b/test/unit/email_process_bounce_follow_test.rb @@ -27,7 +27,8 @@ class EmailProcessBounceFollowUpTest < ActiveSupport::TestCase created_by_id: 1, ) travel 1.second - email_raw_string = IO.binread('test/fixtures/mail33-undelivered-mail-returned-to-sender.box') + email_file_path = Rails.root.join('test', 'data', 'mail', 'mail033-undelivered-mail-returned-to-sender.box') + email_raw_string = File.read(email_file_path) ticket_p, article_p, user_p = Channel::EmailParser.new.process({}, email_raw_string) assert_equal(ticket.id, ticket_p.id) assert_equal('new', ticket_p.state.name) @@ -134,7 +135,8 @@ class EmailProcessBounceFollowUpTest < ActiveSupport::TestCase assert_equal(4, ticket.articles.count) travel 1.second - email_raw_string = IO.binread('test/fixtures/mail33-undelivered-mail-returned-to-sender.box') + email_file_path = Rails.root.join('test', 'data', 'mail', 'mail033-undelivered-mail-returned-to-sender.box') + email_raw_string = File.read(email_file_path) ticket_p, article_p, user_p = Channel::EmailParser.new.process({}, email_raw_string) assert_equal(ticket.id, ticket_p.id) assert_equal('open', ticket_p.state.name) @@ -241,7 +243,8 @@ class EmailProcessBounceFollowUpTest < ActiveSupport::TestCase assert_equal(4, ticket.articles.count) travel 1.second - email_raw_string = IO.binread('test/fixtures/mail55.box') + email_file_path = Rails.root.join('test', 'data', 'mail', 'mail055.box') + email_raw_string = File.read(email_file_path) ticket_p, article_p, user_p = Channel::EmailParser.new.process({}, email_raw_string) assert_equal(ticket.id, ticket_p.id) assert_equal('open', ticket_p.state.name) diff --git a/test/unit/email_process_test.rb b/test/unit/email_process_test.rb index d0d620c60..f1f29b676 100644 --- a/test/unit/email_process_test.rb +++ b/test/unit/email_process_test.rb @@ -406,7 +406,7 @@ Some Text", }, }, { - data: IO.binread('test/fixtures/mail21.box'), + data: File.read(Rails.root.join('test', 'data', 'mail', 'mail021.box')), success: true, result: { 0 => { @@ -512,7 +512,7 @@ Some Text", }, }, { - data: IO.binread('test/fixtures/mail22.box'), + data: File.read(Rails.root.join('test', 'data', 'mail', 'mail022.box')), success: true, result: { 0 => { @@ -529,7 +529,7 @@ Some Text", }, }, { - data: IO.binread('test/fixtures/mail23.box'), + data: File.read(Rails.root.join('test', 'data', 'mail', 'mail023.box')), success: true, result: { 0 => { @@ -2303,7 +2303,7 @@ Some Text', } }, { - data: IO.binread('test/fixtures/mail30.box'), + data: File.read(Rails.root.join('test', 'data', 'mail', 'mail030.box')), success: true, result: { 0 => { @@ -2339,7 +2339,7 @@ Some Text', } }, { - data: IO.binread('test/fixtures/mail31.box'), + data: File.read(Rails.root.join('test', 'data', 'mail', 'mail031.box')), success: true, result: { 0 => { @@ -2363,7 +2363,7 @@ Some Text', } }, { - data: IO.binread('test/fixtures/mail32.box'), + data: File.read(Rails.root.join('test', 'data', 'mail', 'mail032.box')), success: true, result: { 0 => { @@ -2387,7 +2387,7 @@ Some Text', } }, { - data: IO.binread('test/fixtures/mail35.box'), + data: File.read(Rails.root.join('test', 'data', 'mail', 'mail035.box')), success: true, result: { 0 => { @@ -2411,7 +2411,7 @@ Some Text', } }, { - data: IO.binread('test/fixtures/mail37.box'), + data: File.read(Rails.root.join('test', 'data', 'mail', 'mail037.box')), success: true, result: { 0 => { @@ -2447,7 +2447,7 @@ Some Text', } }, { - data: IO.binread('test/fixtures/mail41.box'), + data: File.read(Rails.root.join('test', 'data', 'mail', 'mail041.box')), success: true, result: { 0 => { @@ -2461,7 +2461,7 @@ Some Text', }, }, { - data: IO.binread('test/fixtures/mail42.box'), + data: File.read(Rails.root.join('test', 'data', 'mail', 'mail042.box')), success: true, result: { 0 => { @@ -2475,7 +2475,7 @@ Some Text', }, }, { - data: IO.binread('test/fixtures/mail43.box'), + data: File.read(Rails.root.join('test', 'data', 'mail', 'mail043.box')), success: true, result: { 0 => { @@ -2489,7 +2489,7 @@ Some Text', }, }, { - data: IO.binread('test/fixtures/mail44.box'), + data: File.read(Rails.root.join('test', 'data', 'mail', 'mail044.box')), success: true, result: { 0 => { @@ -2519,7 +2519,7 @@ Some Text', }, }, { - data: IO.binread('test/fixtures/mail46.box'), + data: File.read(Rails.root.join('test', 'data', 'mail', 'mail046.box')), success: true, result: { 0 => { @@ -2544,7 +2544,7 @@ Some Text', }, }, { - data: IO.binread('test/fixtures/mail47.box'), + data: File.read(Rails.root.join('test', 'data', 'mail', 'mail047.box')), success: true, result: { 0 => { @@ -2569,7 +2569,7 @@ Some Text', }, }, { - data: IO.binread('test/fixtures/mail49.box'), + data: File.read(Rails.root.join('test', 'data', 'mail', 'mail049.box')), success: true, result: { 0 => { @@ -2594,7 +2594,7 @@ Some Text', }, }, { - data: IO.binread('test/fixtures/mail52.box'), + data: File.read(Rails.root.join('test', 'data', 'mail', 'mail052.box')), success: true, result: { 0 => { @@ -2619,7 +2619,7 @@ Some Text', }, }, { - data: IO.binread('test/fixtures/mail53.box'), + data: File.read(Rails.root.join('test', 'data', 'mail', 'mail053.box')), success: true, result: { 0 => { @@ -2644,7 +2644,7 @@ Some Text', }, }, { - data: IO.binread('test/fixtures/mail60.box'), + data: File.read(Rails.root.join('test', 'data', 'mail', 'mail060.box')), success: true, result: { 0 => { @@ -2670,7 +2670,7 @@ Some Text', }, }, { - data: IO.binread('test/fixtures/mail64.box'), + data: File.read(Rails.root.join('test', 'data', 'mail', 'mail064.box')), success: true, result: { 0 => { diff --git a/test/unit/email_signatur_detection_test.rb b/test/unit/email_signatur_detection_test.rb deleted file mode 100644 index 37510921a..000000000 --- a/test/unit/email_signatur_detection_test.rb +++ /dev/null @@ -1,132 +0,0 @@ - -require 'test_helper' - -class EmailSignaturDetectionTest < ActiveSupport::TestCase - - test 'test case 1 - sender a' do - - # fixtures of sender a - fixture_files = { - 'email_signature_detection/client_a_1.txt' => { line: 10, content_type: 'text/plain' }, - 'email_signature_detection/client_a_2.txt' => { line: 20, content_type: 'text/plain' }, - 'email_signature_detection/client_a_3.txt' => { line: 6, content_type: 'text/plain' }, - } - - fixture_messages = [] - fixture_files.each do |filepath, value| - value[:content] = File.new( Rails.root.join('test', 'fixtures', filepath), 'r').read - fixture_messages.push value - end - - signature = SignatureDetection.find_signature(fixture_messages) - expected_signature = "\nMit freundlichen Grüßen\n\nBob Smith\nBerechtigungen und dez. Department\n________________________________\n\nMusik AG\nBerechtigungen und dez. Department (ITPBM)\nKastanien 2" - assert_equal(expected_signature, signature) - - fixture_files.each_value do |value| - assert_equal(value[:line], SignatureDetection.find_signature_line(signature, value[:content], value[:content_type])) - end - end - - test 'test case 2 - sender b' do - - fixture_files = { - 'email_signature_detection/client_b_1.txt' => { line: 26, content_type: 'text/plain' }, - 'email_signature_detection/client_b_2.txt' => { line: 4, content_type: 'text/plain' }, - 'email_signature_detection/client_b_3.txt' => { line: 6, content_type: 'text/plain' }, - } - - fixture_messages = [] - fixture_files.each do |filepath, value| - value[:content] = File.new( Rails.root.join('test', 'fixtures', filepath), 'r').read - fixture_messages.push value - end - - signature = SignatureDetection.find_signature(fixture_messages) - expected_signature = "\nFreundliche Grüße\n\nGünter Lässig\nLokale Daten\n\nMusic GmbH\nBaustraße 123, 12345 Max City\nTelefon 0123 5432114\nTelefax 0123 5432139" - assert_equal(expected_signature, signature) - - fixture_files.each_value do |value| - assert_equal(value[:line], SignatureDetection.find_signature_line(signature, value[:content], value[:content_type])) - end - end - - test 'test case 3 - just tests' do - signature = "~~~~~~~~~~~~~~~~~~~~~~~~~~~~\nBob Smith\nABC Organisation\n\nEXAMPLE IT-Service GmbH\nDorten 5 F&E\n12345 Da / Germany\nPhone: +49 (0) 1234 567 890 / +49 (0) 1234 567 891\nFax:     +49 (0) 1234 567 892" - message = File.new(Rails.root.join('test', 'fixtures', 'email_signature_detection', 'example1.html'), 'r').read - signature_line = SignatureDetection.find_signature_line(signature, message, 'text/html') - assert_equal(11, signature_line) - end - - test 'test case 4 - sender c' do - - fixture_files = { - 'email_signature_detection/client_c_1.html' => { line: 8, content_type: 'text/html' }, - 'email_signature_detection/client_c_2.html' => { line: 29, content_type: 'text/html' }, - 'email_signature_detection/client_c_3.html' => { line: 6, content_type: 'text/html' }, - } - - fixture_messages = [] - fixture_files.each do |filepath, value| - value[:content] = File.new( Rails.root.join('test', 'fixtures', filepath), 'r').read - fixture_messages.push value - end - - signature = SignatureDetection.find_signature(fixture_messages) - expected_signature = "\nChristianSmith\nTechnik\n\nTel: +49 12 34 56 78 441\nFax: +49 12 34 56 78 499\nEmail: Christian.Smith@example.com\nWeb: www.example.com\nABC KFZ- und Flugzeug B.V. & Co. KG\nHauptverwaltung" - assert_equal(expected_signature, signature) - - fixture_files.each do |filepath, value| - assert_equal(value[:line], SignatureDetection.find_signature_line(signature, value[:content], value[:content_type]), filepath) - end - end - - test 'test case III - sender a - full cycle' do - raw_email_header = "From: Bob.Smith@music.com\nTo: test@zammad.org\nSubject: test\n\n" - - # process email I - file = File.open(Rails.root.join('test', 'fixtures', 'email_signature_detection', 'client_a_1.txt'), 'rb') - raw_email = raw_email_header + file.read - ticket1, article1, user1, mail = Channel::EmailParser.new.process({}, raw_email) - assert(ticket1) - assert(article1) - Scheduler.worker(true) - - # process email II - file = File.open(Rails.root.join('test', 'fixtures', 'email_signature_detection', 'client_a_2.txt'), 'rb') - raw_email = raw_email_header + file.read - ticket2, article2, user2, mail = Channel::EmailParser.new.process({}, raw_email) - assert(ticket2) - assert(article2) - Scheduler.worker(true) - - # check if user2 has a signature_detection value - user2 = User.find(user2.id) - assert(user2.preferences[:signature_detection]) - - # process email III - file = File.open(Rails.root.join('test', 'fixtures', 'email_signature_detection', 'client_a_3.txt'), 'rb') - raw_email = raw_email_header + file.read - ticket3, article3, user3, mail = Channel::EmailParser.new.process({}, raw_email) - assert(ticket3) - assert(article3) - Scheduler.worker(true) - - # check if article3 has a signature_detection value - article3 = Ticket::Article.find(article3.id) - assert_equal(article3.preferences[:signature_detection], 6) - - # relbuild all - SignatureDetection.rebuild_all_articles - - article1 = Ticket::Article.find(article1.id) - assert_equal(article1.preferences[:signature_detection], 10) - - article2 = Ticket::Article.find(article2.id) - assert_equal(article2.preferences[:signature_detection], 20) - - article3 = Ticket::Article.find(article3.id) - assert_equal(article3.preferences[:signature_detection], 6) - - end - -end diff --git a/test/unit/email_signature_detection_test.rb b/test/unit/email_signature_detection_test.rb new file mode 100644 index 000000000..022fc404b --- /dev/null +++ b/test/unit/email_signature_detection_test.rb @@ -0,0 +1,125 @@ + +require 'test_helper' + +class EmailSignatureDetectionTest < ActiveSupport::TestCase + + test 'test case 1 - sender a' do + message_files = [Rails.root.join('test', 'data', 'email_signature_detection', 'client_a_1.txt'), + Rails.root.join('test', 'data', 'email_signature_detection', 'client_a_2.txt'), + Rails.root.join('test', 'data', 'email_signature_detection', 'client_a_3.txt')] + signature_lines = [10, 20, 6] + + messages = message_files.zip(signature_lines).map do |f, l| + { content: File.read(Rails.root.join('test', 'data', f)), + content_type: 'text/plain', + line: l } + end + + signature = SignatureDetection.find_signature(messages) + expected_signature = "\nMit freundlichen Grüßen\n\nBob Smith\nBerechtigungen und dez. Department\n________________________________\n\nMusik AG\nBerechtigungen und dez. Department (ITPBM)\nKastanien 2" + assert_equal(expected_signature, signature) + + messages.each do |m| + assert_equal(m[:line], SignatureDetection.find_signature_line(signature, m[:content], m[:content_type])) + end + end + + test 'test case 2 - sender b' do + message_files = [Rails.root.join('test', 'data', 'email_signature_detection', 'client_b_1.txt'), + Rails.root.join('test', 'data', 'email_signature_detection', 'client_b_2.txt'), + Rails.root.join('test', 'data', 'email_signature_detection', 'client_b_3.txt')] + signature_lines = [26, 4, 6] + + messages = message_files.zip(signature_lines).map do |f, l| + { content: File.read(Rails.root.join('test', 'data', f)), + content_type: 'text/plain', + line: l } + end + + signature = SignatureDetection.find_signature(messages) + expected_signature = "\nFreundliche Grüße\n\nGünter Lässig\nLokale Daten\n\nMusic GmbH\nBaustraße 123, 12345 Max City\nTelefon 0123 5432114\nTelefax 0123 5432139" + assert_equal(expected_signature, signature) + + messages.each do |m| + assert_equal(m[:line], SignatureDetection.find_signature_line(signature, m[:content], m[:content_type])) + end + end + + test 'test case 3 - just tests' do + signature = "~~~~~~~~~~~~~~~~~~~~~~~~~~~~\nBob Smith\nABC Organisation\n\nEXAMPLE IT-Service GmbH\nDorten 5 F&E\n12345 Da / Germany\nPhone: +49 (0) 1234 567 890 / +49 (0) 1234 567 891\nFax:     +49 (0) 1234 567 892" + message = File.read(Rails.root.join('test', 'data', 'email_signature_detection', 'example1.html')) + signature_line = SignatureDetection.find_signature_line(signature, message, 'text/html') + assert_equal(11, signature_line) + end + + test 'test case 4 - sender c' do + message_files = [Rails.root.join('test', 'data', 'email_signature_detection', 'client_c_1.html'), + Rails.root.join('test', 'data', 'email_signature_detection', 'client_c_2.html'), + Rails.root.join('test', 'data', 'email_signature_detection', 'client_c_3.html')] + signature_lines = [8, 29, 6] + + messages = message_files.zip(signature_lines).map do |f, l| + { content: File.read(Rails.root.join('test', 'data', f)), + content_type: 'text/html', + line: l } + end + + signature = SignatureDetection.find_signature(messages) + expected_signature = "\nChristianSmith\nTechnik\n\nTel: +49 12 34 56 78 441\nFax: +49 12 34 56 78 499\nEmail: Christian.Smith@example.com\nWeb: www.example.com\nABC KFZ- und Flugzeug B.V. & Co. KG\nHauptverwaltung" + assert_equal(expected_signature, signature) + + messages.each do |m| + assert_equal(m[:line], SignatureDetection.find_signature_line(signature, m[:content], m[:content_type])) + end + end + + test 'test case III - sender a - full cycle' do + header = "From: Bob.Smith@music.com\nTo: test@zammad.org\nSubject: test\n\n" + + # process email I + body = File.binread(Rails.root.join('test', 'data', 'email_signature_detection', 'client_a_1.txt')) + raw_email = header + body + ticket1, article1, user1, mail = Channel::EmailParser.new.process({}, raw_email) + assert(ticket1) + assert(article1) + Scheduler.worker(true) + + # process email II + body = File.binread(Rails.root.join('test', 'data', 'email_signature_detection', 'client_a_2.txt')) + raw_email = header + body + ticket2, article2, user2, mail = Channel::EmailParser.new.process({}, raw_email) + assert(ticket2) + assert(article2) + Scheduler.worker(true) + + # check if user2 has a signature_detection value + user2 = User.find(user2.id) + assert(user2.preferences[:signature_detection]) + + # process email III + body = File.binread(Rails.root.join('test', 'data', 'email_signature_detection', 'client_a_3.txt')) + raw_email = header + body + ticket3, article3, user3, mail = Channel::EmailParser.new.process({}, raw_email) + assert(ticket3) + assert(article3) + Scheduler.worker(true) + + # check if article3 has a signature_detection value + article3 = Ticket::Article.find(article3.id) + assert_equal(article3.preferences[:signature_detection], 6) + + # relbuild all + SignatureDetection.rebuild_all_articles + + article1 = Ticket::Article.find(article1.id) + assert_equal(article1.preferences[:signature_detection], 10) + + article2 = Ticket::Article.find(article2.id) + assert_equal(article2.preferences[:signature_detection], 20) + + article3 = Ticket::Article.find(article3.id) + assert_equal(article3.preferences[:signature_detection], 6) + + end + +end diff --git a/test/unit/store_test.rb b/test/unit/store_test.rb index bd1732fce..c0853df73 100644 --- a/test/unit/store_test.rb +++ b/test/unit/store_test.rb @@ -42,12 +42,12 @@ class StoreTest < ActiveSupport::TestCase o_id: 2, }, { - data: IO.binread('test/fixtures/test1.pdf'), + data: File.binread(Rails.root.join('test', 'data', 'pdf', 'test1.pdf')), filename: 'test.pdf', o_id: 3, }, { - data: IO.binread('test/fixtures/test1.pdf'), + data: File.binread(Rails.root.join('test', 'data', 'pdf', 'test1.pdf')), filename: 'test-again.pdf', o_id: 4, }, diff --git a/test/unit/ticket_article_store_empty.rb b/test/unit/ticket_article_store_empty.rb index 913ef2798..99909058f 100644 --- a/test/unit/ticket_article_store_empty.rb +++ b/test/unit/ticket_article_store_empty.rb @@ -9,7 +9,7 @@ class TicketArticleStoreEmpty < ActiveSupport::TestCase current_file_count = Store::File.count current_backend_count = Store::Provider::DB.count - email_raw_string = IO.binread('test/fixtures/mail1.box') + email_raw_string = File.read(Rails.root.join('test', 'data', 'mail', 'mail001.box')) ticket, article, user, mail = Channel::EmailParser.new.process({}, email_raw_string) next_count = Store.count @@ -38,7 +38,7 @@ class TicketArticleStoreEmpty < ActiveSupport::TestCase current_file_count = Store::File.count current_backend_count = Store::Provider::DB.count - email_raw_string = IO.binread('test/fixtures/mail1.box') + email_raw_string = File.read(Rails.root.join('test', 'data', 'mail', 'mail001.box')) ticket1, article1, user1, mail1 = Channel::EmailParser.new.process({}, email_raw_string) ticket2, article2, user2, mail2 = Channel::EmailParser.new.process({}, email_raw_string) diff --git a/test/unit/ticket_trigger_recursive_disabled_test.rb b/test/unit/ticket_trigger_recursive_disabled_test.rb index 658a04d65..a2ddc95ed 100644 --- a/test/unit/ticket_trigger_recursive_disabled_test.rb +++ b/test/unit/ticket_trigger_recursive_disabled_test.rb @@ -707,7 +707,7 @@ class TicketTriggerRecursiveDisabledTest < ActiveSupport::TestCase ) # process mail without Precedence header - content = IO.binread('test/fixtures/ticket_trigger/mail1.box') + content = File.read(Rails.root.join('test', 'data', 'ticket_trigger', 'mail1.box')) ticket_p, article_p, user_p, mail = Channel::EmailParser.new.process({}, content) assert_equal('aaäöüßad asd', ticket_p.title) @@ -833,21 +833,21 @@ class TicketTriggerRecursiveDisabledTest < ActiveSupport::TestCase assert_equal('text/html', article_p.content_type) # process mail without Precedence header - content = IO.binread('test/fixtures/ticket_trigger/mail1.box') + content = File.read(Rails.root.join('test', 'data', 'ticket_trigger', 'mail1.box')) ticket_p, article_p, user_p, mail = Channel::EmailParser.new.process({}, content) assert_equal('new', ticket_p.state.name) assert_equal(2, ticket_p.articles.count) # process mail with Precedence header (no auto response) - content = IO.binread('test/fixtures/ticket_trigger/mail2.box') + content = File.read(Rails.root.join('test', 'data', 'ticket_trigger', 'mail2.box')) ticket_p, article_p, user_p, mail = Channel::EmailParser.new.process({}, content) assert_equal('new', ticket_p.state.name) assert_equal(1, ticket_p.articles.count) # process mail with abuse@ (no auto response) - content = IO.binread('test/fixtures/ticket_trigger/mail3.box') + content = File.read(Rails.root.join('test', 'data', 'ticket_trigger', 'mail3.box')) ticket_p, article_p, user_p, mail = Channel::EmailParser.new.process({}, content) assert_equal('new', ticket_p.state.name) @@ -926,7 +926,7 @@ class TicketTriggerRecursiveDisabledTest < ActiveSupport::TestCase ) # process mail without Precedence header - content = IO.binread('test/fixtures/ticket_trigger/mail1.box') + content = File.read(Rails.root.join('test', 'data', 'ticket_trigger', 'mail1.box')) ticket_p, article_p, user_p, mail = Channel::EmailParser.new.process({}, content) assert_equal('aaäöüßad asd', ticket_p.title) @@ -991,7 +991,7 @@ class TicketTriggerRecursiveDisabledTest < ActiveSupport::TestCase ) # process mail without Precedence header - content = IO.binread('test/fixtures/ticket_trigger/mail1.box') + content = File.read(Rails.root.join('test', 'data', 'ticket_trigger', 'mail1.box')) ticket_p, article_p, user_p, mail = Channel::EmailParser.new.process({}, content) assert_equal('aaäöüßad asd', ticket_p.title) @@ -1076,7 +1076,7 @@ class TicketTriggerRecursiveDisabledTest < ActiveSupport::TestCase ) # process mail without Precedence header - content = IO.binread('test/fixtures/ticket_trigger/mail1.box') + content = File.read(Rails.root.join('test', 'data', 'ticket_trigger', 'mail1.box')) ticket_p, article_p, user_p, mail = Channel::EmailParser.new.process({}, content) assert_equal('aaäöüßad asd', ticket_p.title) @@ -1156,7 +1156,7 @@ class TicketTriggerRecursiveDisabledTest < ActiveSupport::TestCase ) # process mail without Precedence header - content = IO.binread('test/fixtures/ticket_trigger/mail1.box') + content = File.read(Rails.root.join('test', 'data', 'ticket_trigger', 'mail1.box')) ticket_p, article_p, user_p, mail = Channel::EmailParser.new.process({}, content) assert_equal(1, ticket_p.articles.count) @@ -4234,7 +4234,7 @@ class TicketTriggerRecursiveDisabledTest < ActiveSupport::TestCase updated_by_id: 1, ) - ticket1, article1, user, mail = Channel::EmailParser.new.process({}, IO.binread('test/fixtures/mail65.box')) + ticket1, article1, user, mail = Channel::EmailParser.new.process({}, File.read(Rails.root.join('test', 'data', 'mail', 'mail065.box'))) assert_equal('aaäöüßad asd', ticket1.title, 'ticket1.title verify') assert_equal('Users', ticket1.group.name, 'ticket1.group verify') @@ -4275,7 +4275,7 @@ class TicketTriggerRecursiveDisabledTest < ActiveSupport::TestCase updated_by_id: 1, ) - ticket1, article1, user, mail = Channel::EmailParser.new.process({}, IO.binread('test/fixtures/mail65.box')) + ticket1, article1, user, mail = Channel::EmailParser.new.process({}, File.read(Rails.root.join('test', 'data', 'mail', 'mail065.box'))) assert_equal('aaäöüßad asd', ticket1.title, 'ticket1.title verify') assert_equal('Users', ticket1.group.name, 'ticket1.group verify') diff --git a/test/unit/ticket_trigger_test.rb b/test/unit/ticket_trigger_test.rb index c9088db92..af5487cb7 100644 --- a/test/unit/ticket_trigger_test.rb +++ b/test/unit/ticket_trigger_test.rb @@ -721,7 +721,7 @@ class TicketTriggerTest < ActiveSupport::TestCase ) # process mail without Precedence header - content = IO.binread('test/fixtures/ticket_trigger/mail1.box') + content = File.read(Rails.root.join('test', 'data', 'ticket_trigger', 'mail1.box')) ticket_p, article_p, user_p, mail = Channel::EmailParser.new.process({}, content) assert_equal('aaäöüßad asd', ticket_p.title) @@ -847,7 +847,7 @@ class TicketTriggerTest < ActiveSupport::TestCase assert_equal('text/html', article_p.content_type) # process mail without Precedence header - content = IO.binread('test/fixtures/ticket_trigger/mail1.box') + content = File.read(Rails.root.join('test', 'data', 'ticket_trigger', 'mail1.box')) ticket_p1, article_p1, user_p1, mail = Channel::EmailParser.new.process({}, content) assert_not_equal(ticket_p.id, ticket_p1.id) @@ -855,7 +855,7 @@ class TicketTriggerTest < ActiveSupport::TestCase assert_equal(2, ticket_p1.articles.count) # process mail with Precedence header (no auto response) - content = IO.binread('test/fixtures/ticket_trigger/mail2.box') + content = File.read(Rails.root.join('test', 'data', 'ticket_trigger', 'mail2.box')) ticket_p2, article_p2, user_p2, mail = Channel::EmailParser.new.process({}, content) assert_not_equal(ticket_p.id, ticket_p1.id) @@ -865,7 +865,7 @@ class TicketTriggerTest < ActiveSupport::TestCase assert_equal(1, ticket_p2.articles.count) # process mail with abuse@ (no auto response) - content = IO.binread('test/fixtures/ticket_trigger/mail3.box') + content = File.read(Rails.root.join('test', 'data', 'ticket_trigger', 'mail3.box')) ticket_p3, article_p3, user_p3, mail = Channel::EmailParser.new.process({}, content) assert_not_equal(ticket_p.id, ticket_p1.id) @@ -951,7 +951,7 @@ class TicketTriggerTest < ActiveSupport::TestCase ) # process mail without Precedence header - content = IO.binread('test/fixtures/ticket_trigger/mail1.box') + content = File.read(Rails.root.join('test', 'data', 'ticket_trigger', 'mail1.box')) ticket_p, article_p, user_p, mail = Channel::EmailParser.new.process({}, content) assert_equal('aaäöüßad asd', ticket_p.title) @@ -1016,7 +1016,7 @@ class TicketTriggerTest < ActiveSupport::TestCase ) # process mail without Precedence header - content = IO.binread('test/fixtures/ticket_trigger/mail1.box') + content = File.read(Rails.root.join('test', 'data', 'ticket_trigger', 'mail1.box')) ticket_p, article_p, user_p, mail = Channel::EmailParser.new.process({}, content) assert_equal('aaäöüßad asd', ticket_p.title) @@ -1101,7 +1101,7 @@ class TicketTriggerTest < ActiveSupport::TestCase ) # process mail without Precedence header - content = IO.binread('test/fixtures/ticket_trigger/mail1.box') + content = File.read(Rails.root.join('test', 'data', 'ticket_trigger', 'mail1.box')) ticket_p, article_p, user_p, mail = Channel::EmailParser.new.process({}, content) assert_equal('aaäöüßad asd', ticket_p.title) @@ -1181,7 +1181,7 @@ class TicketTriggerTest < ActiveSupport::TestCase ) # process mail without Precedence header - content = IO.binread('test/fixtures/ticket_trigger/mail1.box') + content = File.read(Rails.root.join('test', 'data', 'ticket_trigger', 'mail1.box')) ticket_p, article_p, user_p, mail = Channel::EmailParser.new.process({}, content) assert_equal(1, ticket_p.articles.count) @@ -4259,7 +4259,7 @@ class TicketTriggerTest < ActiveSupport::TestCase updated_by_id: 1, ) - ticket1, article1, user, mail = Channel::EmailParser.new.process({}, IO.binread('test/fixtures/mail65.box')) + ticket1, article1, user, mail = Channel::EmailParser.new.process({}, File.read(Rails.root.join('test', 'data', 'mail', 'mail065.box'))) assert_equal('aaäöüßad asd', ticket1.title, 'ticket1.title verify') assert_equal('Users', ticket1.group.name, 'ticket1.group verify') @@ -4300,7 +4300,7 @@ class TicketTriggerTest < ActiveSupport::TestCase updated_by_id: 1, ) - ticket1, article1, user, mail = Channel::EmailParser.new.process({}, IO.binread('test/fixtures/mail65.box')) + ticket1, article1, user, mail = Channel::EmailParser.new.process({}, File.read(Rails.root.join('test', 'data', 'mail', 'mail065.box'))) assert_equal('aaäöüßad asd', ticket1.title, 'ticket1.title verify') assert_equal('Users', ticket1.group.name, 'ticket1.group verify')