Improved test to match use case/settings of issue #2038.
This commit is contained in:
parent
cda05285f3
commit
d19f8c2b66
1 changed files with 47 additions and 13 deletions
|
@ -196,7 +196,6 @@ no reference "
|
||||||
|
|
||||||
test 'process with follow up check with different ticket hook' do
|
test 'process with follow up check with different ticket hook' do
|
||||||
|
|
||||||
setting_orig = Setting.get('ticket_hook')
|
|
||||||
Setting.set('ticket_hook', 'VD-Ticket#')
|
Setting.set('ticket_hook', 'VD-Ticket#')
|
||||||
|
|
||||||
ticket = Ticket.create(
|
ticket = Ticket.create(
|
||||||
|
@ -243,14 +242,10 @@ Some Text"
|
||||||
assert_equal(ticket.id, ticket_p.id)
|
assert_equal(ticket.id, ticket_p.id)
|
||||||
|
|
||||||
travel_back
|
travel_back
|
||||||
|
|
||||||
Setting.set('ticket_hook', setting_orig)
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
test 'process with follow up check with two external reference headers' do
|
test 'process with follow up check with two external reference headers' do
|
||||||
|
|
||||||
setting_orig = Setting.get('postmaster_follow_up_search_in')
|
|
||||||
Setting.set('postmaster_follow_up_search_in', %w[body attachment references])
|
Setting.set('postmaster_follow_up_search_in', %w[body attachment references])
|
||||||
|
|
||||||
data1 = "From: me@example.com
|
data1 = "From: me@example.com
|
||||||
|
@ -286,7 +281,6 @@ test 123
|
||||||
|
|
||||||
assert_equal(ticket_p2.id, ticket_p3.id)
|
assert_equal(ticket_p2.id, ticket_p3.id)
|
||||||
|
|
||||||
Setting.set('postmaster_follow_up_search_in', setting_orig)
|
|
||||||
travel_back
|
travel_back
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -383,7 +377,6 @@ Some Text"
|
||||||
test 'process with follow up check - ticket initiated by customer without T# in subject and other people in Cc reply to all' do
|
test 'process with follow up check - ticket initiated by customer without T# in subject and other people in Cc reply to all' do
|
||||||
|
|
||||||
# check if follow up based on inital system sender address
|
# check if follow up based on inital system sender address
|
||||||
setting_orig = Setting.get('postmaster_follow_up_search_in')
|
|
||||||
Setting.set('postmaster_follow_up_search_in', [])
|
Setting.set('postmaster_follow_up_search_in', [])
|
||||||
|
|
||||||
subject = "ticket initiated by customer without T# in subject and other people in Cc reply to all #{rand(9999)}"
|
subject = "ticket initiated by customer without T# in subject and other people in Cc reply to all #{rand(9999)}"
|
||||||
|
@ -470,14 +463,11 @@ Some other Text"
|
||||||
assert_equal(ticket5.id, ticket6.id)
|
assert_equal(ticket5.id, ticket6.id)
|
||||||
assert_equal(subject, ticket6.title)
|
assert_equal(subject, ticket6.title)
|
||||||
|
|
||||||
Setting.set('postmaster_follow_up_search_in', setting_orig)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
test 'process with follow up check - with none ticket# in subject' do
|
test 'process with follow up check - with none ticket# in subject' do
|
||||||
|
|
||||||
setting_orig = Setting.get('postmaster_follow_up_search_in')
|
|
||||||
Setting.set('postmaster_follow_up_search_in', [])
|
Setting.set('postmaster_follow_up_search_in', [])
|
||||||
ticket_hook_position_orig = Setting.get('ticket_hook_position')
|
|
||||||
Setting.set('ticket_hook_position', 'none')
|
Setting.set('ticket_hook_position', 'none')
|
||||||
|
|
||||||
subject = 'some title'
|
subject = 'some title'
|
||||||
|
@ -505,9 +495,53 @@ Some Text"
|
||||||
ticket_p2, article_p2, user_p2, mail = Channel::EmailParser.new.process({}, email_raw_string)
|
ticket_p2, article_p2, user_p2, mail = Channel::EmailParser.new.process({}, email_raw_string)
|
||||||
ticket2 = Ticket.find(ticket_p2.id)
|
ticket2 = Ticket.find(ticket_p2.id)
|
||||||
assert_equal(ticket1.id, ticket2.id)
|
assert_equal(ticket1.id, ticket2.id)
|
||||||
|
|
||||||
Setting.set('ticket_hook_position', ticket_hook_position_orig)
|
|
||||||
Setting.set('postmaster_follow_up_search_in', setting_orig)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
test 'process with follow up check - in body' do
|
||||||
|
|
||||||
|
Setting.set('postmaster_follow_up_search_in', %w[body attachment references])
|
||||||
|
Setting.set('ticket_hook', '#')
|
||||||
|
|
||||||
|
email_raw_string = "From: me@example.com
|
||||||
|
To: bob@example.com
|
||||||
|
Subject: some subject
|
||||||
|
|
||||||
|
Some Text"
|
||||||
|
|
||||||
|
ticket_p1, article_1, user_1, mail = Channel::EmailParser.new.process({}, email_raw_string)
|
||||||
|
|
||||||
|
email_raw_string = "From: me@example.com
|
||||||
|
To: bob@example.com
|
||||||
|
Subject: some subject
|
||||||
|
|
||||||
|
Some Text #{Setting.get('ticket_hook')}#{ticket_p1.number} asdasd"
|
||||||
|
|
||||||
|
ticket_p2, article_2, user_2, mail = Channel::EmailParser.new.process({}, email_raw_string)
|
||||||
|
assert_equal(ticket_p1.id, ticket_p2.id)
|
||||||
|
|
||||||
|
email_raw_string = "From: me@example.com
|
||||||
|
To: bob@example.com
|
||||||
|
Subject: some subject
|
||||||
|
Content-Transfer-Encoding: 7bit
|
||||||
|
Content-Type: text/html;
|
||||||
|
|
||||||
|
<b>Some Text #{Setting.get('ticket_hook')}#{ticket_p1.number}</b>
|
||||||
|
"
|
||||||
|
|
||||||
|
ticket_p3, article_3, user_3, mail = Channel::EmailParser.new.process({}, email_raw_string)
|
||||||
|
assert_equal(ticket_p1.id, ticket_p3.id)
|
||||||
|
|
||||||
|
email_raw_string = "From: me@example.com
|
||||||
|
To: bob@example.com
|
||||||
|
Subject: some subject
|
||||||
|
Content-Transfer-Encoding: 8bit
|
||||||
|
Content-Type: text/html;
|
||||||
|
|
||||||
|
<b>Some Text <span color=\"#{Setting.get('ticket_hook')}#{ticket_p1.number}\">test</span></b>
|
||||||
|
"
|
||||||
|
|
||||||
|
ticket_p4, article_4, user_4, mail = Channel::EmailParser.new.process({}, email_raw_string)
|
||||||
|
assert_not_equal(ticket_p1.id, ticket_p4.id)
|
||||||
|
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue