Improved code layout.

This commit is contained in:
Martin Edenhofer 2015-01-02 16:48:28 +01:00
parent 84b9429c5a
commit ca6f3a806b
3 changed files with 246 additions and 246 deletions

View file

@ -36,22 +36,22 @@ returns
result = [ result = [
{ {
:type => 'created', :type => 'created',
:object => 'Organization', :object => 'Organization',
:created_by_id => 3, :created_by_id => 3,
:created_at => "2013-08-19 20:41:33", :created_at => "2013-08-19 20:41:33",
}, },
{ {
:type => 'updated', :type => 'updated',
:object => 'Organization', :object => 'Organization',
:attribute => 'note', :attribute => 'note',
:o_id => 1, :o_id => 1,
:id_to => nil, :id_to => nil,
:id_from => nil, :id_from => nil,
:value_from => "some note", :value_from => "some note",
:value_to => "some other note", :value_to => "some other note",
:created_by_id => 3, :created_by_id => 3,
:created_at => "2013-08-19 20:41:33", :created_at => "2013-08-19 20:41:33",
}, },
] ]

View file

@ -4,13 +4,13 @@ require 'test_helper'
class TicketTest < ActiveSupport::TestCase class TicketTest < ActiveSupport::TestCase
test 'ticket create' do test 'ticket create' do
ticket = Ticket.create( ticket = Ticket.create(
:title => 'some title äöüß', :title => 'some title äöüß',
:group => Group.lookup( :name => 'Users'), :group => Group.lookup( :name => 'Users'),
:customer_id => 2, :customer_id => 2,
:state => Ticket::State.lookup( :name => 'new' ), :state => Ticket::State.lookup( :name => 'new' ),
:priority => Ticket::Priority.lookup( :name => '2 normal' ), :priority => Ticket::Priority.lookup( :name => '2 normal' ),
:updated_by_id => 1, :updated_by_id => 1,
:created_by_id => 1, :created_by_id => 1,
) )
assert( ticket, "ticket created" ) assert( ticket, "ticket created" )
@ -20,17 +20,17 @@ class TicketTest < ActiveSupport::TestCase
# create inbound article # create inbound article
article_inbound = Ticket::Article.create( article_inbound = Ticket::Article.create(
:ticket_id => ticket.id, :ticket_id => ticket.id,
:from => 'some_sender@example.com', :from => 'some_sender@example.com',
:to => 'some_recipient@example.com', :to => 'some_recipient@example.com',
:subject => 'some subject', :subject => 'some subject',
:message_id => 'some@id', :message_id => 'some@id',
:body => 'some message article_inbound 😍😍😍', :body => 'some message article_inbound 😍😍😍',
:internal => false, :internal => false,
:sender => Ticket::Article::Sender.where(:name => 'Customer').first, :sender => Ticket::Article::Sender.where(:name => 'Customer').first,
:type => Ticket::Article::Type.where(:name => 'email').first, :type => Ticket::Article::Type.where(:name => 'email').first,
:updated_by_id => 1, :updated_by_id => 1,
:created_by_id => 1, :created_by_id => 1,
) )
assert_equal( article_inbound.body, 'some message article_inbound 😍😍😍'.utf8_to_3bytesutf8, 'article_inbound.body verify - inbound' ) assert_equal( article_inbound.body, 'some message article_inbound 😍😍😍'.utf8_to_3bytesutf8, 'article_inbound.body verify - inbound' )
@ -44,15 +44,15 @@ class TicketTest < ActiveSupport::TestCase
# create note article # create note article
article_note = Ticket::Article.create( article_note = Ticket::Article.create(
:ticket_id => ticket.id, :ticket_id => ticket.id,
:from => 'some persion', :from => 'some person',
:subject => 'some note', :subject => 'some note',
:body => 'some message', :body => 'some message',
:internal => true, :internal => true,
:sender => Ticket::Article::Sender.where(:name => 'Agent').first, :sender => Ticket::Article::Sender.where(:name => 'Agent').first,
:type => Ticket::Article::Type.where(:name => 'note').first, :type => Ticket::Article::Type.where(:name => 'note').first,
:updated_by_id => 1, :updated_by_id => 1,
:created_by_id => 1, :created_by_id => 1,
) )
ticket = Ticket.find(ticket.id) ticket = Ticket.find(ticket.id)
@ -66,17 +66,17 @@ class TicketTest < ActiveSupport::TestCase
# create outbound article # create outbound article
sleep 10 sleep 10
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',
:to => 'some_sender@example.com', :to => 'some_sender@example.com',
:subject => 'some subject', :subject => 'some subject',
:message_id => 'some@id2', :message_id => 'some@id2',
:body => 'some message 2', :body => 'some message 2',
:internal => false, :internal => false,
:sender => Ticket::Article::Sender.where(:name => 'Agent').first, :sender => Ticket::Article::Sender.where(:name => 'Agent').first,
:type => Ticket::Article::Type.where(:name => 'email').first, :type => Ticket::Article::Type.where(:name => 'email').first,
:updated_by_id => 1, :updated_by_id => 1,
:created_by_id => 1, :created_by_id => 1,
) )
ticket = Ticket.find(ticket.id) ticket = Ticket.find(ticket.id)
@ -112,15 +112,15 @@ class TicketTest < ActiveSupport::TestCase
assert( delete, "ticket destroy_all" ) assert( delete, "ticket destroy_all" )
ticket = Ticket.create( ticket = Ticket.create(
:title => 'some title äöüß', :title => 'some title äöüß',
:group => Group.lookup( :name => 'Users'), :group => Group.lookup( :name => 'Users'),
:customer_id => 2, :customer_id => 2,
:state => Ticket::State.lookup( :name => 'new' ), :state => Ticket::State.lookup( :name => 'new' ),
:priority => Ticket::Priority.lookup( :name => '2 normal' ), :priority => Ticket::Priority.lookup( :name => '2 normal' ),
:created_at => '2013-03-21 09:30:00 UTC', :created_at => '2013-03-21 09:30:00 UTC',
:updated_at => '2013-03-21 09:30:00 UTC', :updated_at => '2013-03-21 09:30:00 UTC',
:updated_by_id => 1, :updated_by_id => 1,
:created_by_id => 1, :created_by_id => 1,
) )
assert( ticket, "ticket created" ) assert( ticket, "ticket created" )
assert_equal( ticket.escalation_time, nil, 'ticket.escalation_time verify' ) assert_equal( ticket.escalation_time, nil, 'ticket.escalation_time verify' )
@ -134,11 +134,11 @@ class TicketTest < ActiveSupport::TestCase
"end_of_workday" => "18:00", "end_of_workday" => "18:00",
}, },
:first_response_time => 120, :first_response_time => 120,
:update_time => 180, :update_time => 180,
:close_time => 240, :close_time => 240,
:active => true, :active => true,
:updated_by_id => 1, :updated_by_id => 1,
:created_by_id => 1, :created_by_id => 1,
) )
ticket = Ticket.find(ticket.id) ticket = Ticket.find(ticket.id)
assert_equal( ticket.escalation_time.gmtime.to_s, '2013-03-21 11:30:00 UTC', 'ticket.escalation_time verify 1' ) assert_equal( ticket.escalation_time.gmtime.to_s, '2013-03-21 11:30:00 UTC', 'ticket.escalation_time verify 1' )
@ -149,19 +149,19 @@ class TicketTest < ActiveSupport::TestCase
assert( delete, "sla destroy 1" ) assert( delete, "sla destroy 1" )
sla = Sla.create( sla = Sla.create(
:name => 'test sla 2', :name => 'test sla 2',
:condition => { "tickets.priority_id" =>["1", "2", "3"] }, :condition => { "tickets.priority_id" =>["1", "2", "3"] },
:data => { :data => {
"Mon"=>"Mon", "Tue"=>"Tue", "Wed"=>"Wed", "Thu"=>"Thu", "Fri"=>"Fri", "Sat"=>"Sat", "Sun"=>"Sun", "Mon"=>"Mon", "Tue"=>"Tue", "Wed"=>"Wed", "Thu"=>"Thu", "Fri"=>"Fri", "Sat"=>"Sat", "Sun"=>"Sun",
"beginning_of_workday" => "8:00", "beginning_of_workday" => "8:00",
"end_of_workday" => "18:00", "end_of_workday" => "18:00",
}, },
:first_response_time => 60, :first_response_time => 60,
:update_time => 120, :update_time => 120,
:close_time => 180, :close_time => 180,
:active => true, :active => true,
:updated_by_id => 1, :updated_by_id => 1,
:created_by_id => 1, :created_by_id => 1,
) )
ticket = Ticket.find(ticket.id) ticket = Ticket.find(ticket.id)
assert_equal( ticket.escalation_time.gmtime.to_s, '2013-03-21 10:30:00 UTC', 'ticket.escalation_time verify 2' ) assert_equal( ticket.escalation_time.gmtime.to_s, '2013-03-21 10:30:00 UTC', 'ticket.escalation_time verify 2' )
@ -258,7 +258,7 @@ class TicketTest < ActiveSupport::TestCase
# set close time in time # set close time in time
ticket.update_attributes( ticket.update_attributes(
:close_time => '2013-03-21 11:30:00 UTC', :close_time => '2013-03-21 11:30:00 UTC',
) )
assert_equal( ticket.escalation_time.gmtime.to_s, '2013-03-21 14:00:00 UTC', 'ticket.escalation_time verify 7' ) assert_equal( ticket.escalation_time.gmtime.to_s, '2013-03-21 14:00:00 UTC', 'ticket.escalation_time verify 7' )
@ -277,7 +277,7 @@ class TicketTest < ActiveSupport::TestCase
# set close time over time # set close time over time
ticket.update_attributes( ticket.update_attributes(
:close_time => '2013-03-21 13:00:00 UTC', :close_time => '2013-03-21 13:00:00 UTC',
) )
assert_equal( ticket.escalation_time.gmtime.to_s, '2013-03-21 14:00:00 UTC', 'ticket.escalation_time verify 8' ) assert_equal( ticket.escalation_time.gmtime.to_s, '2013-03-21 14:00:00 UTC', 'ticket.escalation_time verify 8' )
@ -317,15 +317,15 @@ class TicketTest < ActiveSupport::TestCase
assert( delete, "ticket destroy" ) assert( delete, "ticket destroy" )
ticket = Ticket.create( ticket = Ticket.create(
:title => 'some title äöüß', :title => 'some title äöüß',
:group => Group.lookup( :name => 'Users'), :group => Group.lookup( :name => 'Users'),
:customer_id => 2, :customer_id => 2,
:state => Ticket::State.lookup( :name => 'new' ), :state => Ticket::State.lookup( :name => 'new' ),
:priority => Ticket::Priority.lookup( :name => '2 normal' ), :priority => Ticket::Priority.lookup( :name => '2 normal' ),
:updated_by_id => 1, :updated_by_id => 1,
:created_by_id => 1, :created_by_id => 1,
:created_at => '2013-03-28 23:49:00 UTC', :created_at => '2013-03-28 23:49:00 UTC',
:updated_at => '2013-03-28 23:49:00 UTC', :updated_at => '2013-03-28 23:49:00 UTC',
) )
assert( ticket, "ticket created" ) assert( ticket, "ticket created" )
@ -335,19 +335,19 @@ class TicketTest < ActiveSupport::TestCase
# create inbound article # create inbound article
article_inbound = Ticket::Article.create( article_inbound = Ticket::Article.create(
:ticket_id => ticket.id, :ticket_id => ticket.id,
:from => 'some_sender@example.com', :from => 'some_sender@example.com',
:to => 'some_recipient@example.com', :to => 'some_recipient@example.com',
:subject => 'some subject', :subject => 'some subject',
:message_id => 'some@id', :message_id => 'some@id',
:body => 'some message', :body => 'some message',
:internal => false, :internal => false,
:sender => Ticket::Article::Sender.where(:name => 'Customer').first, :sender => Ticket::Article::Sender.where(:name => 'Customer').first,
:type => Ticket::Article::Type.where(:name => 'email').first, :type => Ticket::Article::Type.where(:name => 'email').first,
:updated_by_id => 1, :updated_by_id => 1,
:created_by_id => 1, :created_by_id => 1,
:created_at => '2013-03-28 23:49:00 UTC', :created_at => '2013-03-28 23:49:00 UTC',
:updated_at => '2013-03-28 23:49:00 UTC', :updated_at => '2013-03-28 23:49:00 UTC',
) )
ticket = Ticket.find(ticket.id) ticket = Ticket.find(ticket.id)
assert_equal( ticket.article_count, 1, 'ticket.article_count verify - inbound' ) assert_equal( ticket.article_count, 1, 'ticket.article_count verify - inbound' )
@ -359,19 +359,19 @@ class TicketTest < ActiveSupport::TestCase
# create outbound article # create outbound article
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',
:to => 'some_sender@example.com', :to => 'some_sender@example.com',
:subject => 'some subject', :subject => 'some subject',
:message_id => 'some@id2', :message_id => 'some@id2',
:body => 'some message 2', :body => 'some message 2',
:internal => false, :internal => false,
:sender => Ticket::Article::Sender.where(:name => 'Agent').first, :sender => Ticket::Article::Sender.where(:name => 'Agent').first,
:type => Ticket::Article::Type.where(:name => 'email').first, :type => Ticket::Article::Type.where(:name => 'email').first,
:updated_by_id => 1, :updated_by_id => 1,
:created_by_id => 1, :created_by_id => 1,
:created_at => '2013-03-29 08:00:03 UTC', :created_at => '2013-03-29 08:00:03 UTC',
:updated_at => '2013-03-29 08:00:03 UTC', :updated_at => '2013-03-29 08:00:03 UTC',
) )
ticket = Ticket.find(ticket.id) ticket = Ticket.find(ticket.id)
@ -389,15 +389,15 @@ class TicketTest < ActiveSupport::TestCase
ticket = Ticket.create( ticket = Ticket.create(
:title => 'some title äöüß', :title => 'some title äöüß',
:group => Group.lookup( :name => 'Users'), :group => Group.lookup( :name => 'Users'),
:customer_id => 2, :customer_id => 2,
:state => Ticket::State.lookup( :name => 'new' ), :state => Ticket::State.lookup( :name => 'new' ),
:priority => Ticket::Priority.lookup( :name => '2 normal' ), :priority => Ticket::Priority.lookup( :name => '2 normal' ),
:updated_by_id => 1, :updated_by_id => 1,
:created_by_id => 1, :created_by_id => 1,
:created_at => '2013-03-28 23:49:00 UTC', :created_at => '2013-03-28 23:49:00 UTC',
:updated_at => '2013-03-28 23:49:00 UTC', :updated_at => '2013-03-28 23:49:00 UTC',
) )
assert( ticket, "ticket created" ) assert( ticket, "ticket created" )
@ -407,18 +407,18 @@ class TicketTest < ActiveSupport::TestCase
# create inbound article # create inbound article
article_inbound = Ticket::Article.create( article_inbound = Ticket::Article.create(
:ticket_id => ticket.id, :ticket_id => ticket.id,
:from => 'some_sender@example.com', :from => 'some_sender@example.com',
:subject => 'some subject', :subject => 'some subject',
:message_id => 'some@id', :message_id => 'some@id',
:body => 'some message', :body => 'some message',
:internal => false, :internal => false,
:sender => Ticket::Article::Sender.where(:name => 'Customer').first, :sender => Ticket::Article::Sender.where(:name => 'Customer').first,
:type => Ticket::Article::Type.where(:name => 'phone').first, :type => Ticket::Article::Type.where(:name => 'phone').first,
:updated_by_id => 1, :updated_by_id => 1,
:created_by_id => 1, :created_by_id => 1,
:created_at => '2013-03-28 23:49:00 UTC', :created_at => '2013-03-28 23:49:00 UTC',
:updated_at => '2013-03-28 23:49:00 UTC', :updated_at => '2013-03-28 23:49:00 UTC',
) )
ticket = Ticket.find(ticket.id) ticket = Ticket.find(ticket.id)
assert_equal( ticket.article_count, 1, 'ticket.article_count verify - inbound' ) assert_equal( ticket.article_count, 1, 'ticket.article_count verify - inbound' )
@ -444,35 +444,35 @@ class TicketTest < ActiveSupport::TestCase
assert( delete, "ticket destroy_all" ) assert( delete, "ticket destroy_all" )
ticket = Ticket.create( ticket = Ticket.create(
:title => 'some title äöüß', :title => 'some title äöüß',
:group => Group.lookup( :name => 'Users'), :group => Group.lookup( :name => 'Users'),
:customer_id => 2, :customer_id => 2,
:state => Ticket::State.lookup( :name => 'new' ), :state => Ticket::State.lookup( :name => 'new' ),
:priority => Ticket::Priority.lookup( :name => '2 normal' ), :priority => Ticket::Priority.lookup( :name => '2 normal' ),
:created_at => '2013-03-21 09:30:00 UTC', :created_at => '2013-03-21 09:30:00 UTC',
:updated_at => '2013-03-21 09:30:00 UTC', :updated_at => '2013-03-21 09:30:00 UTC',
:updated_by_id => 1, :updated_by_id => 1,
:created_by_id => 1, :created_by_id => 1,
) )
assert( ticket, "ticket created" ) assert( ticket, "ticket created" )
assert_equal( ticket.escalation_time, nil, 'ticket.escalation_time verify' ) assert_equal( ticket.escalation_time, nil, 'ticket.escalation_time verify' )
# set sla's for timezone "Europe/Berlin" wintertime (+1), so UTC times are 8:00-17:00 # set sla's for timezone "Europe/Berlin" wintertime (+1), so UTC times are 8:00-17:00
sla = Sla.create( sla = Sla.create(
:name => 'test sla 1', :name => 'test sla 1',
:condition => {}, :condition => {},
:data => { :data => {
"Mon"=>"Mon", "Tue"=>"Tue", "Wed"=>"Wed", "Thu"=>"Thu", "Fri"=>"Fri", "Sat"=>"Sat", "Sun"=>"Sun", "Mon"=>"Mon", "Tue"=>"Tue", "Wed"=>"Wed", "Thu"=>"Thu", "Fri"=>"Fri", "Sat"=>"Sat", "Sun"=>"Sun",
"beginning_of_workday" => "9:00", "beginning_of_workday" => "9:00",
"end_of_workday" => "18:00", "end_of_workday" => "18:00",
}, },
:timezone => 'Europe/Berlin', :timezone => 'Europe/Berlin',
:first_response_time => 120, :first_response_time => 120,
:update_time => 180, :update_time => 180,
:close_time => 240, :close_time => 240,
:active => true, :active => true,
:updated_by_id => 1, :updated_by_id => 1,
:created_by_id => 1, :created_by_id => 1,
) )
ticket = Ticket.find(ticket.id) ticket = Ticket.find(ticket.id)
assert_equal( ticket.escalation_time.gmtime.to_s, '2013-03-21 11:30:00 UTC', 'ticket.escalation_time verify 1' ) assert_equal( ticket.escalation_time.gmtime.to_s, '2013-03-21 11:30:00 UTC', 'ticket.escalation_time verify 1' )
@ -486,35 +486,35 @@ class TicketTest < ActiveSupport::TestCase
delete = ticket.destroy delete = ticket.destroy
assert( delete, "ticket destroy" ) assert( delete, "ticket destroy" )
ticket = Ticket.create( ticket = Ticket.create(
:title => 'some title äöüß', :title => 'some title äöüß',
:group => Group.lookup( :name => 'Users'), :group => Group.lookup( :name => 'Users'),
:customer_id => 2, :customer_id => 2,
:state => Ticket::State.lookup( :name => 'new' ), :state => Ticket::State.lookup( :name => 'new' ),
:priority => Ticket::Priority.lookup( :name => '2 normal' ), :priority => Ticket::Priority.lookup( :name => '2 normal' ),
:created_at => '2013-10-21 09:30:00 UTC', :created_at => '2013-10-21 09:30:00 UTC',
:updated_at => '2013-10-21 09:30:00 UTC', :updated_at => '2013-10-21 09:30:00 UTC',
:updated_by_id => 1, :updated_by_id => 1,
:created_by_id => 1, :created_by_id => 1,
) )
assert( ticket, "ticket created" ) assert( ticket, "ticket created" )
assert_equal( ticket.escalation_time, nil, 'ticket.escalation_time verify' ) assert_equal( ticket.escalation_time, nil, 'ticket.escalation_time verify' )
# set sla's for timezone "Europe/Berlin" summertime (+2), so UTC times are 7:00-16:00 # set sla's for timezone "Europe/Berlin" summertime (+2), so UTC times are 7:00-16:00
sla = Sla.create( sla = Sla.create(
:name => 'test sla 1', :name => 'test sla 1',
:condition => {}, :condition => {},
:data => { :data => {
"Mon"=>"Mon", "Tue"=>"Tue", "Wed"=>"Wed", "Thu"=>"Thu", "Fri"=>"Fri", "Sat"=>"Sat", "Sun"=>"Sun", "Mon"=>"Mon", "Tue"=>"Tue", "Wed"=>"Wed", "Thu"=>"Thu", "Fri"=>"Fri", "Sat"=>"Sat", "Sun"=>"Sun",
"beginning_of_workday" => "9:00", "beginning_of_workday" => "9:00",
"end_of_workday" => "18:00", "end_of_workday" => "18:00",
}, },
:timezone => 'Europe/Berlin', :timezone => 'Europe/Berlin',
:first_response_time => 120, :first_response_time => 120,
:update_time => 180, :update_time => 180,
:close_time => 240, :close_time => 240,
:active => true, :active => true,
:updated_by_id => 1, :updated_by_id => 1,
:created_by_id => 1, :created_by_id => 1,
) )
ticket = Ticket.find(ticket.id) ticket = Ticket.find(ticket.id)
assert_equal( ticket.escalation_time.gmtime.to_s, '2013-10-21 11:30:00 UTC', 'ticket.escalation_time verify 1' ) assert_equal( ticket.escalation_time.gmtime.to_s, '2013-10-21 11:30:00 UTC', 'ticket.escalation_time verify 1' )
@ -529,35 +529,35 @@ class TicketTest < ActiveSupport::TestCase
assert( delete, "sla destroy" ) assert( delete, "sla destroy" )
ticket = Ticket.create( ticket = Ticket.create(
:title => 'some title äöüß', :title => 'some title äöüß',
:group => Group.lookup( :name => 'Users'), :group => Group.lookup( :name => 'Users'),
:customer_id => 2, :customer_id => 2,
:state => Ticket::State.lookup( :name => 'new' ), :state => Ticket::State.lookup( :name => 'new' ),
:priority => Ticket::Priority.lookup( :name => '2 normal' ), :priority => Ticket::Priority.lookup( :name => '2 normal' ),
:created_at => '2013-10-21 06:30:00 UTC', :created_at => '2013-10-21 06:30:00 UTC',
:updated_at => '2013-10-21 06:30:00 UTC', :updated_at => '2013-10-21 06:30:00 UTC',
:updated_by_id => 1, :updated_by_id => 1,
:created_by_id => 1, :created_by_id => 1,
) )
assert( ticket, "ticket created" ) assert( ticket, "ticket created" )
assert_equal( ticket.escalation_time, nil, 'ticket.escalation_time verify' ) assert_equal( ticket.escalation_time, nil, 'ticket.escalation_time verify' )
# set sla's for timezone "Europe/Berlin" summertime (+2), so UTC times are 7:00-16:00 # set sla's for timezone "Europe/Berlin" summertime (+2), so UTC times are 7:00-16:00
sla = Sla.create( sla = Sla.create(
:name => 'test sla 1', :name => 'test sla 1',
:condition => {}, :condition => {},
:data => { :data => {
"Mon"=>"Mon", "Tue"=>"Tue", "Wed"=>"Wed", "Thu"=>"Thu", "Fri"=>"Fri", "Sat"=>"Sat", "Sun"=>"Sun", "Mon"=>"Mon", "Tue"=>"Tue", "Wed"=>"Wed", "Thu"=>"Thu", "Fri"=>"Fri", "Sat"=>"Sat", "Sun"=>"Sun",
"beginning_of_workday" => "9:00", "beginning_of_workday" => "9:00",
"end_of_workday" => "18:00", "end_of_workday" => "18:00",
}, },
:timezone => 'Europe/Berlin', :timezone => 'Europe/Berlin',
:first_response_time => 120, :first_response_time => 120,
:update_time => 180, :update_time => 180,
:close_time => 240, :close_time => 240,
:active => true, :active => true,
:updated_by_id => 1, :updated_by_id => 1,
:created_by_id => 1, :created_by_id => 1,
) )
ticket = Ticket.find(ticket.id) ticket = Ticket.find(ticket.id)
assert_equal( ticket.escalation_time.gmtime.to_s, '2013-10-21 09:00:00 UTC', 'ticket.escalation_time verify 1' ) assert_equal( ticket.escalation_time.gmtime.to_s, '2013-10-21 09:00:00 UTC', 'ticket.escalation_time verify 1' )
@ -575,15 +575,15 @@ class TicketTest < ActiveSupport::TestCase
test 'ticket escalation suspend' do test 'ticket escalation suspend' do
ticket = Ticket.create( ticket = Ticket.create(
:title => 'some title äöüß3', :title => 'some title äöüß3',
:group => Group.lookup( :name => 'Users'), :group => Group.lookup( :name => 'Users'),
:customer_id => 2, :customer_id => 2,
:state => Ticket::State.lookup( :name => 'new' ), :state => Ticket::State.lookup( :name => 'new' ),
:priority => Ticket::Priority.lookup( :name => '2 normal' ), :priority => Ticket::Priority.lookup( :name => '2 normal' ),
:created_at => '2013-06-04 09:00:00 UTC', :created_at => '2013-06-04 09:00:00 UTC',
:updated_at => '2013-06-04 09:00:00 UTC', :updated_at => '2013-06-04 09:00:00 UTC',
:updated_by_id => 1, :updated_by_id => 1,
:created_by_id => 1, :created_by_id => 1,
) )
assert( ticket, 'ticket created' ) assert( ticket, 'ticket created' )
@ -648,20 +648,20 @@ class TicketTest < ActiveSupport::TestCase
# set sla's for timezone "Europe/Berlin" summertime (+2), so UTC times are 7:00-16:00 # set sla's for timezone "Europe/Berlin" summertime (+2), so UTC times are 7:00-16:00
sla = Sla.create( sla = Sla.create(
:name => 'test sla 1', :name => 'test sla 1',
:condition => {}, :condition => {},
:data => { :data => {
"Mon"=>"Mon", "Tue"=>"Tue", "Wed"=>"Wed", "Thu"=>"Thu", "Fri"=>"Fri", "Sat"=>"Sat", "Sun"=>"Sun", "Mon"=>"Mon", "Tue"=>"Tue", "Wed"=>"Wed", "Thu"=>"Thu", "Fri"=>"Fri", "Sat"=>"Sat", "Sun"=>"Sun",
"beginning_of_workday" => "9:00", "beginning_of_workday" => "9:00",
"end_of_workday" => "18:00", "end_of_workday" => "18:00",
}, },
:timezone => 'Europe/Berlin', :timezone => 'Europe/Berlin',
:first_response_time => 120, :first_response_time => 120,
:update_time => 180, :update_time => 180,
:close_time => 250, :close_time => 250,
:active => true, :active => true,
:updated_by_id => 1, :updated_by_id => 1,
:created_by_id => 1, :created_by_id => 1,
) )
ticket = Ticket.find(ticket.id) ticket = Ticket.find(ticket.id)
assert_equal( ticket.escalation_time.gmtime.to_s, '2013-06-04 13:30:00 UTC', 'ticket.escalation_time verify 1' ) assert_equal( ticket.escalation_time.gmtime.to_s, '2013-06-04 13:30:00 UTC', 'ticket.escalation_time verify 1' )
@ -680,15 +680,15 @@ class TicketTest < ActiveSupport::TestCase
# test Ticket created in state pending and closed without reopen or state change # test Ticket created in state pending and closed without reopen or state change
ticket = Ticket.create( ticket = Ticket.create(
:title => 'some title äöüß3', :title => 'some title äöüß3',
:group => Group.lookup( :name => 'Users'), :group => Group.lookup( :name => 'Users'),
:customer_id => 2, :customer_id => 2,
:state => Ticket::State.lookup( :name => 'pending' ), :state => Ticket::State.lookup( :name => 'pending' ),
:priority => Ticket::Priority.lookup( :name => '2 normal' ), :priority => Ticket::Priority.lookup( :name => '2 normal' ),
:created_at => '2013-06-04 09:00:00 UTC', :created_at => '2013-06-04 09:00:00 UTC',
:updated_at => '2013-06-04 09:00:00 UTC', :updated_at => '2013-06-04 09:00:00 UTC',
:updated_by_id => 1, :updated_by_id => 1,
:created_by_id => 1, :created_by_id => 1,
) )
assert( ticket, 'ticket created' ) assert( ticket, 'ticket created' )
@ -712,19 +712,19 @@ class TicketTest < ActiveSupport::TestCase
) )
sla = Sla.create( sla = Sla.create(
:name => 'test sla 1', :name => 'test sla 1',
:condition => {}, :condition => {},
:data => { :data => {
"Mon"=>"Mon", "Tue"=>"Tue", "Wed"=>"Wed", "Thu"=>"Thu", "Fri"=>"Fri", "Sat"=>"Sat", "Sun"=>"Sun", "Mon"=>"Mon", "Tue"=>"Tue", "Wed"=>"Wed", "Thu"=>"Thu", "Fri"=>"Fri", "Sat"=>"Sat", "Sun"=>"Sun",
"beginning_of_workday" => "9:00", "beginning_of_workday" => "9:00",
"end_of_workday" => "18:00", "end_of_workday" => "18:00",
}, },
:first_response_time => 120, :first_response_time => 120,
:update_time => 180, :update_time => 180,
:close_time => 240, :close_time => 240,
:active => true, :active => true,
:updated_by_id => 1, :updated_by_id => 1,
:created_by_id => 1, :created_by_id => 1,
) )
ticket = Ticket.find(ticket.id) ticket = Ticket.find(ticket.id)
@ -746,15 +746,15 @@ class TicketTest < ActiveSupport::TestCase
# test Ticket created in state pending, changed state to openen, back to pending and closed # test Ticket created in state pending, changed state to openen, back to pending and closed
ticket = Ticket.create( ticket = Ticket.create(
:title => 'some title äöüß3', :title => 'some title äöüß3',
:group => Group.lookup( :name => 'Users'), :group => Group.lookup( :name => 'Users'),
:customer_id => 2, :customer_id => 2,
:state => Ticket::State.lookup( :name => 'pending' ), :state => Ticket::State.lookup( :name => 'pending' ),
:priority => Ticket::Priority.lookup( :name => '2 normal' ), :priority => Ticket::Priority.lookup( :name => '2 normal' ),
:created_at => '2013-06-04 09:00:00 UTC', :created_at => '2013-06-04 09:00:00 UTC',
:updated_at => '2013-06-04 09:00:00 UTC', :updated_at => '2013-06-04 09:00:00 UTC',
:updated_by_id => 1, :updated_by_id => 1,
:created_by_id => 1, :created_by_id => 1,
) )
assert( ticket, 'ticket created' ) assert( ticket, 'ticket created' )
@ -807,19 +807,19 @@ class TicketTest < ActiveSupport::TestCase
) )
sla = Sla.create( sla = Sla.create(
:name => 'test sla 1', :name => 'test sla 1',
:condition => {}, :condition => {},
:data => { :data => {
"Mon"=>"Mon", "Tue"=>"Tue", "Wed"=>"Wed", "Thu"=>"Thu", "Fri"=>"Fri", "Sat"=>"Sat", "Sun"=>"Sun", "Mon"=>"Mon", "Tue"=>"Tue", "Wed"=>"Wed", "Thu"=>"Thu", "Fri"=>"Fri", "Sat"=>"Sat", "Sun"=>"Sun",
"beginning_of_workday" => "9:00", "beginning_of_workday" => "9:00",
"end_of_workday" => "18:00", "end_of_workday" => "18:00",
}, },
:first_response_time => 120, :first_response_time => 120,
:update_time => 180, :update_time => 180,
:close_time => 240, :close_time => 240,
:active => true, :active => true,
:updated_by_id => 1, :updated_by_id => 1,
:created_by_id => 1, :created_by_id => 1,
) )
ticket = Ticket.find(ticket.id) ticket = Ticket.find(ticket.id)
@ -841,15 +841,15 @@ class TicketTest < ActiveSupport::TestCase
### Test Ticket created in state pending, changed state to openen, back to pending and back to open then ### Test Ticket created in state pending, changed state to openen, back to pending and back to open then
### close ticket ### close ticket
ticket = Ticket.create( ticket = Ticket.create(
:title => 'some title äöüß3', :title => 'some title äöüß3',
:group => Group.lookup( :name => 'Users'), :group => Group.lookup( :name => 'Users'),
:customer_id => 2, :customer_id => 2,
:state => Ticket::State.lookup( :name => 'pending' ), :state => Ticket::State.lookup( :name => 'pending' ),
:priority => Ticket::Priority.lookup( :name => '2 normal' ), :priority => Ticket::Priority.lookup( :name => '2 normal' ),
:created_at => '2013-06-04 09:00:00 UTC', :created_at => '2013-06-04 09:00:00 UTC',
:updated_at => '2013-06-04 09:00:00 UTC', :updated_at => '2013-06-04 09:00:00 UTC',
:updated_by_id => 1, :updated_by_id => 1,
:created_by_id => 1, :created_by_id => 1,
) )
assert( ticket, 'ticket created' ) assert( ticket, 'ticket created' )
@ -917,19 +917,19 @@ class TicketTest < ActiveSupport::TestCase
) )
sla = Sla.create( sla = Sla.create(
:name => 'test sla 1', :name => 'test sla 1',
:condition => {}, :condition => {},
:data => { :data => {
"Mon"=>"Mon", "Tue"=>"Tue", "Wed"=>"Wed", "Thu"=>"Thu", "Fri"=>"Fri", "Sat"=>"Sat", "Sun"=>"Sun", "Mon"=>"Mon", "Tue"=>"Tue", "Wed"=>"Wed", "Thu"=>"Thu", "Fri"=>"Fri", "Sat"=>"Sat", "Sun"=>"Sun",
"beginning_of_workday" => "9:00", "beginning_of_workday" => "9:00",
"end_of_workday" => "18:00", "end_of_workday" => "18:00",
}, },
:first_response_time => 120, :first_response_time => 120,
:update_time => 180, :update_time => 180,
:close_time => 240, :close_time => 240,
:active => true, :active => true,
:updated_by_id => 1, :updated_by_id => 1,
:created_by_id => 1, :created_by_id => 1,
) )
ticket = Ticket.find(ticket.id) ticket = Ticket.find(ticket.id)