Merge branch 'develop' of https://github.com/zammad/zammad into develop

This commit is contained in:
Thorsten Eckel 2016-12-07 16:11:33 +01:00
commit c826625ce7
17 changed files with 68 additions and 75 deletions

View file

@ -4,7 +4,6 @@ require 'test_helper'
class ActivityStreamTest < ActiveSupport::TestCase class ActivityStreamTest < ActiveSupport::TestCase
admin_user = nil admin_user = nil
current_user = nil current_user = nil
activity_record_delay = nil
test 'aaa - setup' do test 'aaa - setup' do
role = Role.lookup(name: 'Admin') role = Role.lookup(name: 'Admin')
group = Group.lookup(name: 'Users') group = Group.lookup(name: 'Users')
@ -21,12 +20,6 @@ class ActivityStreamTest < ActiveSupport::TestCase
created_by_id: 1 created_by_id: 1
) )
current_user = User.lookup(email: 'nicole.braun@zammad.org') current_user = User.lookup(email: 'nicole.braun@zammad.org')
activity_record_delay = if ENV['ZAMMAD_ACTIVITY_RECORD_DELAY']
ENV['ZAMMAD_ACTIVITY_RECORD_DELAY'].to_i.seconds
else
90.seconds
end
end end
test 'ticket+user' do test 'ticket+user' do
@ -101,7 +94,7 @@ class ActivityStreamTest < ActiveSupport::TestCase
test[:check][2][:o_id] = ticket.id test[:check][2][:o_id] = ticket.id
test[:check][2][:created_at] = ticket.created_at test[:check][2][:created_at] = ticket.created_at
test[:check][2][:created_by_id] = current_user.id test[:check][2][:created_by_id] = current_user.id
sleep 2 travel 2.seconds
test[:create][:article][:ticket_id] = ticket.id test[:create][:article][:ticket_id] = ticket.id
article = Ticket::Article.create(test[:create][:article]) article = Ticket::Article.create(test[:create][:article])
@ -129,7 +122,7 @@ class ActivityStreamTest < ActiveSupport::TestCase
article.update_attributes(test[:update][:article]) article.update_attributes(test[:update][:article])
end end
sleep activity_record_delay + 1 travel 1.second
if test[:update][:ticket] if test[:update][:ticket]
ticket.update_attributes(test[:update][:ticket]) ticket.update_attributes(test[:update][:ticket])
end end
@ -196,7 +189,7 @@ class ActivityStreamTest < ActiveSupport::TestCase
test[:check][0][:o_id] = organization.id test[:check][0][:o_id] = organization.id
test[:check][0][:created_at] = organization.created_at test[:check][0][:created_at] = organization.created_at
test[:check][0][:created_by_id] = current_user.id test[:check][0][:created_by_id] = current_user.id
sleep 2 travel 2.seconds
assert_equal(organization.class.to_s, 'Organization') assert_equal(organization.class.to_s, 'Organization')
@ -205,7 +198,7 @@ class ActivityStreamTest < ActiveSupport::TestCase
test[:check][1][:o_id] = organization.id test[:check][1][:o_id] = organization.id
test[:check][1][:updated_at] = organization.updated_at test[:check][1][:updated_at] = organization.updated_at
test[:check][1][:created_by_id] = current_user.id test[:check][1][:created_by_id] = current_user.id
sleep activity_record_delay - 1 travel 1.second
end end
if test[:update2][:organization] if test[:update2][:organization]
@ -353,7 +346,7 @@ class ActivityStreamTest < ActiveSupport::TestCase
end end
# to verify update which need to be logged # to verify update which need to be logged
sleep activity_record_delay + 1 travel 1.second
if test[:update2][:user] if test[:update2][:user]
user.update_attributes(test[:update2][:user]) user.update_attributes(test[:update2][:user])

View file

@ -84,7 +84,7 @@ class AssetsTest < ActiveSupport::TestCase
assert( diff(attributes, assets[:User][user3.id]), 'check assets' ) assert( diff(attributes, assets[:User][user3.id]), 'check assets' )
# touch org, check if user1 has changed # touch org, check if user1 has changed
sleep 2 travel 2.seconds
org2 = Organization.find(org.id) org2 = Organization.find(org.id)
org2.note = "some note...#{rand(9_999_999_999_999)}" org2.note = "some note...#{rand(9_999_999_999_999)}"
org2.save org2.save
@ -232,7 +232,7 @@ class AssetsTest < ActiveSupport::TestCase
assert_nil( assets[:User][user3.id], 'check assets' ) assert_nil( assets[:User][user3.id], 'check assets' )
# touch user 2, check if org has changed # touch user 2, check if org has changed
sleep 2 travel 2.seconds
user_new_2 = User.find(user2.id) user_new_2 = User.find(user2.id)
user_new_2.lastname = 'assets2' user_new_2.lastname = 'assets2'
user_new_2.save user_new_2.save

View file

@ -19,7 +19,7 @@ class CalendarTest < ActiveSupport::TestCase
updated_by_id: 1, updated_by_id: 1,
created_by_id: 1, created_by_id: 1,
) )
sleep 1 travel 1.second
calendar2 = Calendar.create_or_update( calendar2 = Calendar.create_or_update(
name: 'US 2', name: 'US 2',
timezone: 'America/Los_Angeles', timezone: 'America/Los_Angeles',

View file

@ -208,19 +208,19 @@ class ChatTest < ActiveSupport::TestCase
content: 'message 1', content: 'message 1',
created_by_id: agent1.id, created_by_id: agent1.id,
) )
sleep 1 travel 1.second
Chat::Message.create( Chat::Message.create(
chat_session_id: chat_session6.id, chat_session_id: chat_session6.id,
content: 'message 2', content: 'message 2',
created_by_id: agent1.id, created_by_id: agent1.id,
) )
sleep 1 travel 1.second
Chat::Message.create( Chat::Message.create(
chat_session_id: chat_session6.id, chat_session_id: chat_session6.id,
content: 'message 3', content: 'message 3',
created_by_id: agent1.id, created_by_id: agent1.id,
) )
sleep 1 travel 1.second
Chat::Message.create( Chat::Message.create(
chat_session_id: chat_session6.id, chat_session_id: chat_session6.id,
content: 'message 4', content: 'message 4',

View file

@ -27,7 +27,7 @@ class EmailProcessBounceTest < ActiveSupport::TestCase
updated_by_id: 1, updated_by_id: 1,
created_by_id: 1, created_by_id: 1,
) )
sleep 1 travel 1.second
email_raw_string = IO.binread('test/fixtures/mail33-undelivered-mail-returned-to-sender.box') email_raw_string = IO.binread('test/fixtures/mail33-undelivered-mail-returned-to-sender.box')
ticket_p, article_p, user_p = Channel::EmailParser.new.process({}, email_raw_string) ticket_p, article_p, user_p = Channel::EmailParser.new.process({}, email_raw_string)
assert_equal(ticket.id, ticket_p.id) assert_equal(ticket.id, ticket_p.id)

View file

@ -84,45 +84,45 @@ no reference "
setting_orig = Setting.get('postmaster_follow_up_search_in') 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))
sleep 1 travel 1.second
ticket_p, article_p, user_p = Channel::EmailParser.new.process({}, email_raw_string_subject) ticket_p, article_p, user_p = Channel::EmailParser.new.process({}, email_raw_string_subject)
assert_equal(ticket.id, ticket_p.id) assert_equal(ticket.id, ticket_p.id)
sleep 1 travel 1.second
ticket_p, article_p, user_p = Channel::EmailParser.new.process({}, email_raw_string_body) ticket_p, article_p, user_p = Channel::EmailParser.new.process({}, email_raw_string_body)
assert_equal(ticket.id, ticket_p.id) assert_equal(ticket.id, ticket_p.id)
sleep 1 travel 1.second
ticket_p, article_p, user_p = Channel::EmailParser.new.process({}, email_raw_string_attachment) ticket_p, article_p, user_p = Channel::EmailParser.new.process({}, email_raw_string_attachment)
assert_equal(ticket.id, ticket_p.id) assert_equal(ticket.id, ticket_p.id)
sleep 1 travel 1.second
ticket_p, article_p, user_p = Channel::EmailParser.new.process({}, email_raw_string_references1) ticket_p, article_p, user_p = Channel::EmailParser.new.process({}, email_raw_string_references1)
assert_equal(ticket.id, ticket_p.id) assert_equal(ticket.id, ticket_p.id)
sleep 1 travel 1.second
ticket_p, article_p, user_p = Channel::EmailParser.new.process({}, email_raw_string_references2) ticket_p, article_p, user_p = Channel::EmailParser.new.process({}, email_raw_string_references2)
assert_equal(ticket.id, ticket_p.id) assert_equal(ticket.id, ticket_p.id)
Setting.set('postmaster_follow_up_search_in', setting_orig) Setting.set('postmaster_follow_up_search_in', setting_orig)
sleep 1 travel 1.second
ticket_p, article_p, user_p = Channel::EmailParser.new.process({}, email_raw_string_subject) ticket_p, article_p, user_p = Channel::EmailParser.new.process({}, email_raw_string_subject)
assert_equal(ticket.id, ticket_p.id) assert_equal(ticket.id, ticket_p.id)
sleep 1 travel 1.second
ticket_p, article_p, user_p = Channel::EmailParser.new.process({}, email_raw_string_body) ticket_p, article_p, user_p = Channel::EmailParser.new.process({}, email_raw_string_body)
assert_not_equal(ticket.id, ticket_p.id) assert_not_equal(ticket.id, ticket_p.id)
sleep 1 travel 1.second
ticket_p, article_p, user_p = Channel::EmailParser.new.process({}, email_raw_string_attachment) ticket_p, article_p, user_p = Channel::EmailParser.new.process({}, email_raw_string_attachment)
assert_not_equal(ticket.id, ticket_p.id) assert_not_equal(ticket.id, ticket_p.id)
sleep 1 travel 1.second
ticket_p, article_p, user_p = Channel::EmailParser.new.process({}, email_raw_string_references1) ticket_p, article_p, user_p = Channel::EmailParser.new.process({}, email_raw_string_references1)
assert_not_equal(ticket.id, ticket_p.id) assert_not_equal(ticket.id, ticket_p.id)
sleep 1 travel 1.second
ticket_p, article_p, user_p = Channel::EmailParser.new.process({}, email_raw_string_references2) ticket_p, article_p, user_p = Channel::EmailParser.new.process({}, email_raw_string_references2)
assert_not_equal(ticket.id, ticket_p.id) assert_not_equal(ticket.id, ticket_p.id)
end end
@ -141,7 +141,7 @@ test 123
" "
ticket_p1, article_p1, user_p1 = Channel::EmailParser.new.process({}, data1) ticket_p1, article_p1, user_p1 = Channel::EmailParser.new.process({}, data1)
sleep 1 travel 1.second
data1 = "From: me@example.com data1 = "From: me@example.com
To: z@example.com To: z@example.com
@ -193,7 +193,7 @@ test 123
updated_by_id: 1, updated_by_id: 1,
created_by_id: 1, created_by_id: 1,
) )
sleep 1 travel 1.second
# auto response without T# in subject, find follow up by references header # auto response without T# in subject, find follow up by references header
email_raw_string = "From: bob@example.com email_raw_string = "From: bob@example.com
@ -237,7 +237,7 @@ Some Text"
updated_by_id: 1, updated_by_id: 1,
created_by_id: 1, created_by_id: 1,
) )
sleep 1 travel 1.second
system_id = Setting.get('system_id') system_id = Setting.get('system_id')
ticket_hook = Setting.get('ticket_hook') ticket_hook = Setting.get('ticket_hook')

View file

@ -27,7 +27,7 @@ class EmailProcessOutOfOfficeTest < ActiveSupport::TestCase
updated_by_id: 1, updated_by_id: 1,
created_by_id: 1, created_by_id: 1,
) )
sleep 1 travel 1.second
# exchange out of office example #1 # exchange out of office example #1
email_raw_string = "From: me@example.com email_raw_string = "From: me@example.com
@ -113,7 +113,7 @@ Some Text"
updated_by_id: 1, updated_by_id: 1,
created_by_id: 1, created_by_id: 1,
) )
sleep 1 travel 1.second
# exchange out of office example #1 # exchange out of office example #1
email_raw_string = "From: me@example.com email_raw_string = "From: me@example.com
@ -191,7 +191,7 @@ Some Text"
updated_by_id: 1, updated_by_id: 1,
created_by_id: 1, created_by_id: 1,
) )
sleep 1 travel 1.second
# exchange out of office example #1 # exchange out of office example #1
email_raw_string = "From: me@example.com email_raw_string = "From: me@example.com
@ -264,7 +264,7 @@ Some Text"
updated_by_id: 1, updated_by_id: 1,
created_by_id: 1, created_by_id: 1,
) )
sleep 1 travel 1.second
# gmail out of office example #1 # gmail out of office example #1
email_raw_string = "From: me@example.com email_raw_string = "From: me@example.com

View file

@ -329,7 +329,7 @@ class KarmaTest < ActiveSupport::TestCase
item: 'Tag1', item: 'Tag1',
created_by_id: agent1.id, created_by_id: agent1.id,
) )
#sleep 5 #travel 5.seconds
Tag.tag_add( Tag.tag_add(
object: 'Ticket', object: 'Ticket',
o_id: ticket1.id, o_id: ticket1.id,

View file

@ -81,7 +81,7 @@ class OrganizationRefObjectTouchTest < ActiveSupport::TestCase
assert_equal(ticket.customer.id, customer1.id) assert_equal(ticket.customer.id, customer1.id)
assert_equal(ticket.organization.id, organization1.id) assert_equal(ticket.organization.id, organization1.id)
sleep 4 travel 4.seconds
organization1.name = 'Ref Object Update Org 1/1' organization1.name = 'Ref Object Update Org 1/1'
organization1.save organization1.save
@ -101,7 +101,7 @@ class OrganizationRefObjectTouchTest < ActiveSupport::TestCase
assert(false, 'customer1.updated_at has not been updated') assert(false, 'customer1.updated_at has not been updated')
end end
sleep 4 travel 4.seconds
customer2.organization_id = organization1.id customer2.organization_id = organization1.id
customer2.save customer2.save

View file

@ -29,11 +29,11 @@ class RecentViewTest < ActiveSupport::TestCase
RecentView.user_log_destroy(user1) RecentView.user_log_destroy(user1)
RecentView.log(ticket1.class.to_s, ticket1.id, user1) RecentView.log(ticket1.class.to_s, ticket1.id, user1)
sleep 1 travel 1.second
RecentView.log(ticket2.class.to_s, ticket2.id, user1) RecentView.log(ticket2.class.to_s, ticket2.id, user1)
sleep 1 travel 1.second
RecentView.log(ticket1.class.to_s, ticket1.id, user1) RecentView.log(ticket1.class.to_s, ticket1.id, user1)
sleep 1 travel 1.second
RecentView.log(ticket1.class.to_s, ticket1.id, user1) RecentView.log(ticket1.class.to_s, ticket1.id, user1)
list = RecentView.list(user1) list = RecentView.list(user1)

View file

@ -19,7 +19,7 @@ class SessionBasicTest < ActiveSupport::TestCase
assert_equal(false, result, 'check 1 - expired') assert_equal(false, result, 'check 1 - expired')
# should be expired # should be expired
sleep 2 travel 2.seconds
result = Sessions::CacheIn.expired('last_run_test') result = Sessions::CacheIn.expired('last_run_test')
assert_equal(true, result, 'check 1 - expired') assert_equal(true, result, 'check 1 - expired')
@ -32,7 +32,7 @@ class SessionBasicTest < ActiveSupport::TestCase
assert_equal(false, result, 'check 1 - expired') assert_equal(false, result, 'check 1 - expired')
# ignore expired # ignore expired
sleep 2 travel 2.seconds
result = Sessions::CacheIn.get('last_run_test', ignore_expire: true) result = Sessions::CacheIn.get('last_run_test', ignore_expire: true)
assert_equal(true, result, 'check 1 - ignore_expire') assert_equal(true, result, 'check 1 - ignore_expire')
@ -124,14 +124,14 @@ class SessionBasicTest < ActiveSupport::TestCase
# next check should be empty # next check should be empty
result1 = collection_client1.push result1 = collection_client1.push
assert(!result1, 'check collections - recall') assert(!result1, 'check collections - recall')
sleep 1 travel 1.second
result2 = collection_client2.push result2 = collection_client2.push
assert(!result2, 'check collections - recall') assert(!result2, 'check collections - recall')
# change collection # change collection
group = Group.first group = Group.first
group.touch group.touch
sleep 4 travel 4.seconds
# get whole collections # get whole collections
result1 = collection_client1.push result1 = collection_client1.push
@ -149,7 +149,7 @@ class SessionBasicTest < ActiveSupport::TestCase
# change collection # change collection
group = Group.create(name: "SomeGroup::#{rand(999_999)}", active: true) group = Group.create(name: "SomeGroup::#{rand(999_999)}", active: true)
sleep 4 travel 4.seconds
# get whole collections # get whole collections
result1 = collection_client1.push result1 = collection_client1.push
@ -159,7 +159,7 @@ class SessionBasicTest < ActiveSupport::TestCase
assert_equal(result1, result2, 'check collections') assert_equal(result1, result2, 'check collections')
# check again after create # check again after create
sleep 4 travel 4.seconds
result1 = collection_client1.push result1 = collection_client1.push
assert(!result1, 'check collections - after create - recall') assert(!result1, 'check collections - after create - recall')
result2 = collection_client2.push result2 = collection_client2.push
@ -168,7 +168,7 @@ class SessionBasicTest < ActiveSupport::TestCase
# change collection # change collection
group.destroy group.destroy
sleep 4 travel 4.seconds
# get whole collections # get whole collections
result1 = collection_client1.push result1 = collection_client1.push
@ -178,7 +178,7 @@ class SessionBasicTest < ActiveSupport::TestCase
assert_equal(result1, result2, 'check collections') assert_equal(result1, result2, 'check collections')
# check again after destroy # check again after destroy
sleep 4 travel 4.seconds
result1 = collection_client1.push result1 = collection_client1.push
assert(!result1, 'check collections - after destroy - recall') assert(!result1, 'check collections - after destroy - recall')
result2 = collection_client2.push result2 = collection_client2.push
@ -211,21 +211,21 @@ class SessionBasicTest < ActiveSupport::TestCase
# get as stream # get as stream
result1 = as_client1.push result1 = as_client1.push
assert(result1, 'check as agent1') assert(result1, 'check as agent1')
sleep 1 travel 1.second
# next check should be empty # next check should be empty
result1 = as_client1.push result1 = as_client1.push
assert(!result1, 'check as agent1 - recall') assert(!result1, 'check as agent1 - recall')
# next check should be empty # next check should be empty
sleep 4 travel 4.seconds
result1 = as_client1.push result1 = as_client1.push
assert(!result1, 'check as agent1 - recall 2') assert(!result1, 'check as agent1 - recall 2')
agent1.update_attribute(:email, 'activity-stream-agent11@example.com') agent1.update_attribute(:email, 'activity-stream-agent11@example.com')
ticket = Ticket.create(title: '12323', group_id: 1, priority_id: 1, state_id: 1, customer_id: 1) ticket = Ticket.create(title: '12323', group_id: 1, priority_id: 1, state_id: 1, customer_id: 1)
sleep 4 travel 4.seconds
# get as stream # get as stream
result1 = as_client1.push result1 = as_client1.push
@ -254,7 +254,7 @@ class SessionBasicTest < ActiveSupport::TestCase
Group.create(name: "SomeTicketCreateGroup::#{rand(999_999)}", active: true) Group.create(name: "SomeTicketCreateGroup::#{rand(999_999)}", active: true)
sleep 4 travel 4.seconds
# get as stream # get as stream
result1 = ticket_create_client1.push result1 = ticket_create_client1.push

View file

@ -38,17 +38,17 @@ class SessionBasicTicketTest < ActiveSupport::TestCase
assert(!result1, 'check ticket_overview_index - recall') assert(!result1, 'check ticket_overview_index - recall')
# next check should be empty / no changes # next check should be empty / no changes
sleep 3 travel 3.seconds
result1 = client1.push result1 = client1.push
assert(!result1, 'check ticket_overview_index - recall 2') assert(!result1, 'check ticket_overview_index - recall 2')
# create ticket # create ticket
ticket = Ticket.create(title: '12323', group_id: 1, priority_id: 1, state_id: 1, customer_id: 1) ticket = Ticket.create(title: '12323', group_id: 1, priority_id: 1, state_id: 1, customer_id: 1)
sleep 3 travel 3.seconds
result1 = client1.push result1 = client1.push
assert(result1, 'check ticket_overview_index - recall 3') assert(result1, 'check ticket_overview_index - recall 3')
sleep 3 travel 3.seconds
# chnage overview # chnage overview
overviews = Ticket::Overviews.all( overviews = Ticket::Overviews.all(

View file

@ -67,7 +67,7 @@ class SessionCollectionsTest < ActiveSupport::TestCase
assert(check_if_collection_exists(result1, :Role), 'check collections - after init') assert(check_if_collection_exists(result1, :Role), 'check collections - after init')
assert(check_if_collection_exists(result1, :Signature), 'check collections - after init') assert(check_if_collection_exists(result1, :Signature), 'check collections - after init')
assert(check_if_collection_exists(result1, :EmailAddress), 'check collections - after init') assert(check_if_collection_exists(result1, :EmailAddress), 'check collections - after init')
sleep 1 travel 1.second
result2 = collection_client2.push result2 = collection_client2.push
assert(result2, 'check collections') assert(result2, 'check collections')
assert(check_if_collection_exists(result2, :Group), 'check collections - after init') assert(check_if_collection_exists(result2, :Group), 'check collections - after init')
@ -108,7 +108,7 @@ class SessionCollectionsTest < ActiveSupport::TestCase
# change collection # change collection
group = Group.first group = Group.first
group.touch group.touch
sleep 3 travel 3.seconds
# get whole collections # get whole collections
result1 = collection_client1.push result1 = collection_client1.push

View file

@ -184,7 +184,7 @@ class TagTest < ActiveSupport::TestCase
updated_by_id: 1, updated_by_id: 1,
created_by_id: 1, created_by_id: 1,
) )
sleep 2 travel 2.seconds
Tag.tag_add( Tag.tag_add(
object: 'Ticket', object: 'Ticket',
o_id: ticket1.id, o_id: ticket1.id,
@ -266,7 +266,7 @@ class TagTest < ActiveSupport::TestCase
assert(tags_ticket2.include?('some tag4')) assert(tags_ticket2.include?('some tag4'))
# rename tag # rename tag
sleep 2 travel 2.seconds
tag_item3 = Tag::Item.find_by(name: 'some tag3') tag_item3 = Tag::Item.find_by(name: 'some tag3')
Tag::Item.rename( Tag::Item.rename(
id: tag_item3.id, id: tag_item3.id,
@ -300,7 +300,7 @@ class TagTest < ActiveSupport::TestCase
assert(tags_ticket2.include?('some tag4')) assert(tags_ticket2.include?('some tag4'))
# merge tags # merge tags
sleep 2 travel 2.seconds
Tag::Item.rename( Tag::Item.rename(
id: tag_item3.id, id: tag_item3.id,
name: 'some tag2', name: 'some tag2',
@ -333,7 +333,7 @@ class TagTest < ActiveSupport::TestCase
assert_not(Tag::Item.find_by(id: tag_item3.id)) assert_not(Tag::Item.find_by(id: tag_item3.id))
# remove tag item # remove tag item
sleep 2 travel 2.seconds
tag_item4 = Tag::Item.find_by(name: 'some TAG4') tag_item4 = Tag::Item.find_by(name: 'some TAG4')
Tag::Item.remove(tag_item4.id) Tag::Item.remove(tag_item4.id)

View file

@ -90,7 +90,7 @@ class TicketRefObjectTouchTest < ActiveSupport::TestCase
assert(false, 'organization1.updated_at has not been updated') assert(false, 'organization1.updated_at has not been updated')
end end
sleep 4 travel 4.seconds
delete = ticket.destroy delete = ticket.destroy
assert(delete, 'ticket destroy') assert(delete, 'ticket destroy')
@ -113,7 +113,7 @@ class TicketRefObjectTouchTest < ActiveSupport::TestCase
test 'c - check if customer (not organization) has been updated' do test 'c - check if customer (not organization) has been updated' do
sleep 6 travel 6.seconds
ticket = Ticket.create( ticket = Ticket.create(
title: "some title2\n äöüß", title: "some title2\n äöüß",
group: Group.lookup(name: 'Users'), group: Group.lookup(name: 'Users'),
@ -143,7 +143,7 @@ class TicketRefObjectTouchTest < ActiveSupport::TestCase
assert(true, 'organization1.updated_at has not been updated') assert(true, 'organization1.updated_at has not been updated')
end end
sleep 4 travel 4.seconds
delete = ticket.destroy delete = ticket.destroy
assert(delete, 'ticket destroy') assert(delete, 'ticket destroy')

View file

@ -100,7 +100,7 @@ class TicketSelectorTest < ActiveSupport::TestCase
assert(ticket1, 'ticket created') assert(ticket1, 'ticket created')
assert_equal(ticket1.customer.id, customer1.id) assert_equal(ticket1.customer.id, customer1.id)
assert_equal(ticket1.organization.id, organization1.id) assert_equal(ticket1.organization.id, organization1.id)
sleep 1 travel 1.second
ticket2 = Ticket.create!( ticket2 = Ticket.create!(
title: 'some title2', title: 'some title2',
@ -116,7 +116,7 @@ class TicketSelectorTest < ActiveSupport::TestCase
assert(ticket2, 'ticket created') assert(ticket2, 'ticket created')
assert_equal(ticket2.customer.id, customer2.id) assert_equal(ticket2.customer.id, customer2.id)
assert_equal(ticket2.organization_id, nil) assert_equal(ticket2.organization_id, nil)
sleep 1 travel 1.second
ticket3 = Ticket.create!( ticket3 = Ticket.create!(
title: 'some title3', title: 'some title3',
@ -133,7 +133,7 @@ class TicketSelectorTest < ActiveSupport::TestCase
assert(ticket3, 'ticket created') assert(ticket3, 'ticket created')
assert_equal(ticket3.customer.id, customer2.id) assert_equal(ticket3.customer.id, customer2.id)
assert_equal(ticket3.organization_id, nil) assert_equal(ticket3.organization_id, nil)
sleep 1 travel 1.second
# search not matching # search not matching
condition = { condition = {

View file

@ -43,7 +43,7 @@ class TicketTest < ActiveSupport::TestCase
assert_equal(ticket.close_at, nil, 'ticket.close_at verify - inbound') assert_equal(ticket.close_at, nil, 'ticket.close_at verify - inbound')
# create inbound article #2 # create inbound article #2
sleep 2 travel 2.seconds
article_inbound2 = Ticket::Article.create( article_inbound2 = Ticket::Article.create(
ticket_id: ticket.id, ticket_id: ticket.id,
from: 'some_sender@example.com', from: 'some_sender@example.com',
@ -91,7 +91,7 @@ class TicketTest < ActiveSupport::TestCase
assert_equal(ticket.close_at, nil, 'ticket.close_at verify - note') assert_equal(ticket.close_at, nil, 'ticket.close_at verify - note')
# create outbound article # create outbound article
sleep 2 travel 2.seconds
article_outbound = Ticket::Article.create( article_outbound = Ticket::Article.create(
ticket_id: ticket.id, ticket_id: ticket.id,
from: 'some_recipient@example.com', from: 'some_recipient@example.com',
@ -139,7 +139,7 @@ class TicketTest < ActiveSupport::TestCase
assert_equal(ticket.close_at, nil, 'ticket.close_at verify - outbound') assert_equal(ticket.close_at, nil, 'ticket.close_at verify - outbound')
# create inbound article #4 # create inbound article #4
sleep 2 travel 2.seconds
article_inbound4 = Ticket::Article.create( article_inbound4 = Ticket::Article.create(
ticket_id: ticket.id, ticket_id: ticket.id,
from: 'some_sender@example.com', from: 'some_sender@example.com',
@ -207,7 +207,7 @@ class TicketTest < ActiveSupport::TestCase
) )
assert_equal(Ticket.latest_change.to_s, ticket1.updated_at.to_s) assert_equal(Ticket.latest_change.to_s, ticket1.updated_at.to_s)
sleep 1 travel 1.second
ticket2 = Ticket.create( ticket2 = Ticket.create(
title: 'latest change 2', title: 'latest change 2',
@ -220,13 +220,13 @@ class TicketTest < ActiveSupport::TestCase
) )
assert_equal(Ticket.latest_change.to_s, ticket2.updated_at.to_s) assert_equal(Ticket.latest_change.to_s, ticket2.updated_at.to_s)
sleep 1 travel 1.second
ticket1.title = 'latest change 1 - 1' ticket1.title = 'latest change 1 - 1'
ticket1.save ticket1.save
assert_equal(Ticket.latest_change.to_s, ticket1.updated_at.to_s) assert_equal(Ticket.latest_change.to_s, ticket1.updated_at.to_s)
sleep 1 travel 1.second
ticket1.touch ticket1.touch
assert_equal(Ticket.latest_change.to_s, ticket1.updated_at.to_s) assert_equal(Ticket.latest_change.to_s, ticket1.updated_at.to_s)