123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952 |
- # encoding: utf-8
- require 'test_helper'
- class TicketTest < ActiveSupport::TestCase
- test 'ticket create' do
- ticket = Ticket.create(
- :title => 'some title äöüß',
- :group => Group.lookup( :name => 'Users'),
- :customer_id => 2,
- :state => Ticket::State.lookup( :name => 'new' ),
- :priority => Ticket::Priority.lookup( :name => '2 normal' ),
- :updated_by_id => 1,
- :created_by_id => 1,
- )
- assert( ticket, "ticket created" )
- assert_equal( ticket.title, 'some title äöüß', 'ticket.title verify' )
- assert_equal( ticket.group.name, 'Users', 'ticket.group verify' )
- assert_equal( ticket.state.name, 'new', 'ticket.state verify' )
- # create inbound article
- article_inbound = Ticket::Article.create(
- :ticket_id => ticket.id,
- :from => 'some_sender@example.com',
- :to => 'some_recipient@example.com',
- :subject => 'some subject',
- :message_id => 'some@id',
- :body => 'some message article_inbound 😍😍😍',
- :internal => false,
- :sender => Ticket::Article::Sender.where(:name => 'Customer').first,
- :type => Ticket::Article::Type.where(:name => 'email').first,
- :updated_by_id => 1,
- :created_by_id => 1,
- )
- assert_equal( article_inbound.body, 'some message article_inbound 😍😍😍'.utf8_to_3bytesutf8, 'article_inbound.body verify - inbound' )
- ticket = Ticket.find(ticket.id)
- assert_equal( ticket.article_count, 1, 'ticket.article_count verify - inbound' )
- assert_equal( ticket.last_contact.to_s, article_inbound.created_at.to_s, 'ticket.last_contact verify - inbound' )
- assert_equal( ticket.last_contact_customer.to_s, article_inbound.created_at.to_s, 'ticket.last_contact_customer verify - inbound' )
- assert_equal( ticket.last_contact_agent, nil, 'ticket.last_contact_agent verify - inbound' )
- assert_equal( ticket.first_response, nil, 'ticket.first_response verify - inbound' )
- assert_equal( ticket.close_time, nil, 'ticket.close_time verify - inbound' )
- # create note article
- article_note = Ticket::Article.create(
- :ticket_id => ticket.id,
- :from => 'some persion',
- :subject => 'some note',
- :body => 'some message',
- :internal => true,
- :sender => Ticket::Article::Sender.where(:name => 'Agent').first,
- :type => Ticket::Article::Type.where(:name => 'note').first,
- :updated_by_id => 1,
- :created_by_id => 1,
- )
- ticket = Ticket.find(ticket.id)
- assert_equal( ticket.article_count, 2, 'ticket.article_count verify - note' )
- assert_equal( ticket.last_contact.to_s, article_inbound.created_at.to_s, 'ticket.last_contact verify - note' )
- assert_equal( ticket.last_contact_customer.to_s, article_inbound.created_at.to_s, 'ticket.last_contact_customer verify - note' )
- assert_equal( ticket.last_contact_agent, nil, 'ticket.last_contact_agent verify - note' )
- assert_equal( ticket.first_response, nil, 'ticket.first_response verify - note' )
- assert_equal( ticket.close_time, nil, 'ticket.close_time verify - note' )
- # create outbound article
- sleep 10
- article_outbound = Ticket::Article.create(
- :ticket_id => ticket.id,
- :from => 'some_recipient@example.com',
- :to => 'some_sender@example.com',
- :subject => 'some subject',
- :message_id => 'some@id2',
- :body => 'some message 2',
- :internal => false,
- :sender => Ticket::Article::Sender.where(:name => 'Agent').first,
- :type => Ticket::Article::Type.where(:name => 'email').first,
- :updated_by_id => 1,
- :created_by_id => 1,
- )
- ticket = Ticket.find(ticket.id)
- assert_equal( ticket.article_count, 3, 'ticket.article_count verify - outbound' )
- assert_equal( ticket.last_contact.to_s, article_outbound.created_at.to_s, 'ticket.last_contact verify - outbound' )
- assert_equal( ticket.last_contact_customer.to_s, article_inbound.created_at.to_s, 'ticket.last_contact_customer verify - outbound' )
- assert_equal( ticket.last_contact_agent.to_s, article_outbound.created_at.to_s, 'ticket.last_contact_agent verify - outbound' )
- assert_equal( ticket.first_response.to_s, article_outbound.created_at.to_s, 'ticket.first_response verify - outbound' )
- assert_equal( ticket.close_time, nil, 'ticket.close_time verify - outbound' )
- ticket.state_id = Ticket::State.where(:name => 'closed').first.id
- ticket.save
- ticket = Ticket.find(ticket.id)
- assert_equal( ticket.article_count, 3, 'ticket.article_count verify - state update' )
- assert_equal( ticket.last_contact.to_s, article_outbound.created_at.to_s, 'ticket.last_contact verify - state update' )
- assert_equal( ticket.last_contact_customer.to_s, article_inbound.created_at.to_s, 'ticket.last_contact_customer verify - state update' )
- assert_equal( ticket.last_contact_agent.to_s, article_outbound.created_at.to_s, 'ticket.last_contact_agent verify - state update' )
- assert_equal( ticket.first_response.to_s, article_outbound.created_at.to_s, 'ticket.first_response verify - state update' )
- assert( ticket.close_time, 'ticket.close_time verify - state update' )
- delete = ticket.destroy
- assert( delete, "ticket destroy" )
- end
- test 'ticket sla' do
- # cleanup
- delete = Sla.destroy_all
- assert( delete, "sla destroy_all" )
- delete = Ticket.destroy_all
- assert( delete, "ticket destroy_all" )
- ticket = Ticket.create(
- :title => 'some title äöüß',
- :group => Group.lookup( :name => 'Users'),
- :customer_id => 2,
- :state => Ticket::State.lookup( :name => 'new' ),
- :priority => Ticket::Priority.lookup( :name => '2 normal' ),
- :created_at => '2013-03-21 09:30:00 UTC',
- :updated_at => '2013-03-21 09:30:00 UTC',
- :updated_by_id => 1,
- :created_by_id => 1,
- )
- assert( ticket, "ticket created" )
- assert_equal( ticket.escalation_time, nil, 'ticket.escalation_time verify' )
- sla = Sla.create(
- :name => 'test sla 1',
- :condition => {},
- :data => {
- "Mon"=>"Mon", "Tue"=>"Tue", "Wed"=>"Wed", "Thu"=>"Thu", "Fri"=>"Fri", "Sat"=>"Sat", "Sun"=>"Sun",
- "beginning_of_workday" => "8:00",
- "end_of_workday" => "18:00",
- },
- :first_response_time => 120,
- :update_time => 180,
- :close_time => 240,
- :active => true,
- :updated_by_id => 1,
- :created_by_id => 1,
- )
- 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.first_response_escal_date.gmtime.to_s, '2013-03-21 11:30:00 UTC', 'ticket.first_response_escal_date verify 1' )
- assert_equal( ticket.update_time_escal_date.gmtime.to_s, '2013-03-21 12:30:00 UTC', 'ticket.update_time_escal_date verify 1' )
- assert_equal( ticket.close_time_escal_date.gmtime.to_s, '2013-03-21 13:30:00 UTC', 'ticket.close_time_escal_date verify 1' )
- delete = sla.destroy
- assert( delete, "sla destroy 1" )
- sla = Sla.create(
- :name => 'test sla 2',
- :condition => { "tickets.priority_id" =>["1", "2", "3"] },
- :data => {
- "Mon"=>"Mon", "Tue"=>"Tue", "Wed"=>"Wed", "Thu"=>"Thu", "Fri"=>"Fri", "Sat"=>"Sat", "Sun"=>"Sun",
- "beginning_of_workday" => "8:00",
- "end_of_workday" => "18:00",
- },
- :first_response_time => 60,
- :update_time => 120,
- :close_time => 180,
- :active => true,
- :updated_by_id => 1,
- :created_by_id => 1,
- )
- 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.first_response_escal_date.gmtime.to_s, '2013-03-21 10:30:00 UTC', 'ticket.first_response_escal_date verify 2' )
- assert_equal( ticket.first_response, nil, 'ticket.first_response verify 2' )
- assert_equal( ticket.first_response_in_min, nil, 'ticket.first_response_in_min verify 2' )
- assert_equal( ticket.first_response_diff_in_min, nil, 'ticket.first_response_diff_in_min verify 2' )
- assert_equal( ticket.update_time_escal_date.gmtime.to_s, '2013-03-21 11:30:00 UTC', 'ticket.update_time_escal_date verify 2' )
- assert_equal( ticket.update_time_in_min, nil, 'ticket.update_time_in_min verify 2' )
- assert_equal( ticket.update_time_diff_in_min, nil, 'ticket.update_time_diff_in_min verify 2' )
- assert_equal( ticket.close_time_escal_date.gmtime.to_s, '2013-03-21 12:30:00 UTC', 'ticket.close_time_escal_date verify 2' )
- assert_equal( ticket.close_time_in_min, nil, 'ticket.close_time_in_min verify 2' )
- assert_equal( ticket.close_time_diff_in_min, nil, 'ticket.close_time_diff_in_min verify 2' )
- # set first response in time
- ticket.update_attributes(
- :first_response => '2013-03-21 10:00:00 UTC',
- )
- puts ticket.inspect
- assert_equal( ticket.escalation_time.gmtime.to_s, '2013-03-21 11:30:00 UTC', 'ticket.escalation_time verify 3' )
- assert_equal( ticket.first_response_escal_date.gmtime.to_s, '2013-03-21 10:30:00 UTC', 'ticket.first_response_escal_date verify 3' )
- assert_equal( ticket.first_response.gmtime.to_s, '2013-03-21 10:00:00 UTC', 'ticket.first_response verify 3' )
- assert_equal( ticket.first_response_in_min, 30, 'ticket.first_response_in_min verify 3' )
- assert_equal( ticket.first_response_diff_in_min, 30, 'ticket.first_response_diff_in_min verify 3' )
- assert_equal( ticket.update_time_escal_date.gmtime.to_s, '2013-03-21 11:30:00 UTC', 'ticket.update_time_escal_date verify 3' )
- assert_equal( ticket.update_time_in_min, nil, 'ticket.update_time_in_min verify 3' )
- assert_equal( ticket.update_time_diff_in_min, nil, 'ticket.update_time_diff_in_min verify 3' )
- assert_equal( ticket.close_time_escal_date.gmtime.to_s, '2013-03-21 12:30:00 UTC', 'ticket.close_time_escal_date verify 3' )
- assert_equal( ticket.close_time_in_min, nil, 'ticket.close_time_in_min verify 3' )
- assert_equal( ticket.close_time_diff_in_min, nil, 'ticket.close_time_diff_in_min verify 3' )
- # set first reponse over time
- ticket.update_attributes(
- :first_response => '2013-03-21 14:00:00 UTC',
- )
- puts ticket.inspect
- assert_equal( ticket.escalation_time.gmtime.to_s, '2013-03-21 11:30:00 UTC', 'ticket.escalation_time verify 4' )
- assert_equal( ticket.first_response_escal_date.gmtime.to_s, '2013-03-21 10:30:00 UTC', 'ticket.first_response_escal_date verify 4' )
- assert_equal( ticket.first_response.gmtime.to_s, '2013-03-21 14:00:00 UTC', 'ticket.first_response verify 4' )
- assert_equal( ticket.first_response_in_min, 270, 'ticket.first_response_in_min verify 4' )
- assert_equal( ticket.first_response_diff_in_min, -210, 'ticket.first_response_diff_in_min verify 4' )
- assert_equal( ticket.update_time_escal_date.gmtime.to_s, '2013-03-21 11:30:00 UTC', 'ticket.update_time_escal_date verify 4' )
- assert_equal( ticket.update_time_in_min, nil, 'ticket.update_time_in_min verify 4' )
- assert_equal( ticket.update_time_diff_in_min, nil, 'ticket.update_time_diff_in_min verify 4' )
- assert_equal( ticket.close_time_escal_date.gmtime.to_s, '2013-03-21 12:30:00 UTC', 'ticket.close_time_escal_date verify 4' )
- assert_equal( ticket.close_time_in_min, nil, 'ticket.close_time_in_min verify 4' )
- assert_equal( ticket.close_time_diff_in_min, nil, 'ticket.close_time_diff_in_min verify 4' )
- # set update time in time
- ticket.update_attributes(
- :last_contact_agent => '2013-03-21 11:00:00 UTC',
- )
- assert_equal( ticket.escalation_time.gmtime.to_s, '2013-03-21 12:30:00 UTC', 'ticket.escalation_time verify 5' )
- assert_equal( ticket.first_response_escal_date.gmtime.to_s, '2013-03-21 10:30:00 UTC', 'ticket.first_response_escal_date verify 5' )
- assert_equal( ticket.first_response.gmtime.to_s, '2013-03-21 14:00:00 UTC', 'ticket.first_response verify 5' )
- assert_equal( ticket.first_response_in_min, 270, 'ticket.first_response_in_min verify 5' )
- assert_equal( ticket.first_response_diff_in_min, -210, 'ticket.first_response_diff_in_min verify 5' )
- assert_equal( ticket.update_time_escal_date.gmtime.to_s, '2013-03-21 13:00:00 UTC', 'ticket.update_time_escal_date verify 5' )
- assert_equal( ticket.update_time_in_min, 90, 'ticket.update_time_in_min verify 5' )
- assert_equal( ticket.update_time_diff_in_min, 30, 'ticket.update_time_diff_in_min verify 5' )
- assert_equal( ticket.close_time_escal_date.gmtime.to_s, '2013-03-21 12:30:00 UTC', 'ticket.close_time_escal_date verify 5' )
- assert_equal( ticket.close_time_in_min, nil, 'ticket.close_time_in_min verify 5' )
- assert_equal( ticket.close_time_diff_in_min, nil, 'ticket.close_time_diff_in_min verify 5' )
- # set update time over time
- ticket.update_attributes(
- :last_contact_agent => '2013-03-21 12:00:00 UTC',
- )
- assert_equal( ticket.escalation_time.gmtime.to_s, '2013-03-21 12:30:00 UTC', 'ticket.escalation_time verify 6' )
- assert_equal( ticket.first_response_escal_date.gmtime.to_s, '2013-03-21 10:30:00 UTC', 'ticket.first_response_escal_date verify 6' )
- assert_equal( ticket.first_response.gmtime.to_s, '2013-03-21 14:00:00 UTC', 'ticket.first_response verify 6' )
- assert_equal( ticket.first_response_in_min, 270, 'ticket.first_response_in_min verify 6' )
- assert_equal( ticket.first_response_diff_in_min, -210, 'ticket.first_response_diff_in_min verify 6' )
- assert_equal( ticket.update_time_escal_date.gmtime.to_s, '2013-03-21 14:00:00 UTC', 'ticket.update_time_escal_date verify 6' )
- assert_equal( ticket.update_time_in_min, 150, 'ticket.update_time_in_min verify 6' )
- assert_equal( ticket.update_time_diff_in_min, -30, 'ticket.update_time_diff_in_min verify 6' )
- assert_equal( ticket.close_time_escal_date.gmtime.to_s, '2013-03-21 12:30:00 UTC', 'ticket.close_time_escal_date verify 6' )
- assert_equal( ticket.close_time_in_min, nil, 'ticket.close_time_in_min verify 6' )
- assert_equal( ticket.close_time_diff_in_min, nil, 'ticket.close_time_diff_in_min verify 6' )
- # set close time in time
- ticket.update_attributes(
- :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.first_response_escal_date.gmtime.to_s, '2013-03-21 10:30:00 UTC', 'ticket.first_response_escal_date verify 7' )
- assert_equal( ticket.first_response.gmtime.to_s, '2013-03-21 14:00:00 UTC', 'ticket.first_response verify 7' )
- assert_equal( ticket.first_response_in_min, 270, 'ticket.first_response_in_min verify 7' )
- assert_equal( ticket.first_response_diff_in_min, -210, 'ticket.first_response_diff_in_min verify 7' )
- assert_equal( ticket.update_time_escal_date.gmtime.to_s, '2013-03-21 14:00:00 UTC', 'ticket.update_time_escal_date verify 7' )
- assert_equal( ticket.update_time_in_min, 150, 'ticket.update_time_in_min verify 7' )
- assert_equal( ticket.update_time_diff_in_min, -30, 'ticket.update_time_diff_in_min verify 7' )
- assert_equal( ticket.close_time_escal_date.gmtime.to_s, '2013-03-21 12:30:00 UTC', 'ticket.close_time_escal_date verify 7' )
- assert_equal( ticket.close_time_in_min, 120, 'ticket.close_time_in_min verify 7' )
- assert_equal( ticket.close_time_diff_in_min, 60, 'ticket.close_time_diff_in_min verify 7' )
- # set close time over time
- ticket.update_attributes(
- :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.first_response_escal_date.gmtime.to_s, '2013-03-21 10:30:00 UTC', 'ticket.first_response_escal_date verify 8' )
- assert_equal( ticket.first_response.gmtime.to_s, '2013-03-21 14:00:00 UTC', 'ticket.first_response verify 8' )
- assert_equal( ticket.first_response_in_min, 270, 'ticket.first_response_in_min verify 8' )
- assert_equal( ticket.first_response_diff_in_min, -210, 'ticket.first_response_diff_in_min verify 8' )
- assert_equal( ticket.update_time_escal_date.gmtime.to_s, '2013-03-21 14:00:00 UTC', 'ticket.update_time_escal_date verify 8' )
- assert_equal( ticket.update_time_in_min, 150, 'ticket.update_time_in_min verify 8' )
- assert_equal( ticket.update_time_diff_in_min, -30, 'ticket.update_time_diff_in_min verify 8' )
- assert_equal( ticket.close_time_escal_date.gmtime.to_s, '2013-03-21 12:30:00 UTC', 'ticket.close_time_escal_date verify 8' )
- assert_equal( ticket.close_time_in_min, 210, 'ticket.close_time_in_min verify 8' )
- assert_equal( ticket.close_time_diff_in_min, -30, 'ticket.close_time_diff_in_min verify 8' )
- # set close time over time
- ticket.update_attributes(
- :state => Ticket::State.lookup( :name => 'closed' )
- )
- assert_equal( ticket.escalation_time, nil, 'ticket.escalation_time verify 9' )
- assert_equal( ticket.first_response_escal_date.gmtime.to_s, '2013-03-21 10:30:00 UTC', 'ticket.first_response_escal_date verify 9' )
- assert_equal( ticket.first_response.gmtime.to_s, '2013-03-21 14:00:00 UTC', 'ticket.first_response verify 9' )
- assert_equal( ticket.first_response_in_min, 270, 'ticket.first_response_in_min verify 9' )
- assert_equal( ticket.first_response_diff_in_min, -210, 'ticket.first_response_diff_in_min verify 9' )
- assert_equal( ticket.update_time_escal_date.gmtime.to_s, '2013-03-21 14:00:00 UTC', 'ticket.update_time_escal_date verify 9' )
- assert_equal( ticket.update_time_in_min, 150, 'ticket.update_time_in_min verify 9' )
- assert_equal( ticket.update_time_diff_in_min, -30, 'ticket.update_time_diff_in_min verify 9' )
- assert_equal( ticket.close_time_escal_date.gmtime.to_s, '2013-03-21 12:30:00 UTC', 'ticket.close_time_escal_date verify 9' )
- assert_equal( ticket.close_time_in_min, 210, 'ticket.close_time_in_min verify 9' )
- assert_equal( ticket.close_time_diff_in_min, -30, 'ticket.close_time_diff_in_min verify 9' )
- delete = ticket.destroy
- assert( delete, "ticket destroy" )
- ticket = Ticket.create(
- :title => 'some title äöüß',
- :group => Group.lookup( :name => 'Users'),
- :customer_id => 2,
- :state => Ticket::State.lookup( :name => 'new' ),
- :priority => Ticket::Priority.lookup( :name => '2 normal' ),
- :updated_by_id => 1,
- :created_by_id => 1,
- :created_at => '2013-03-28 23:49:00 UTC',
- :updated_at => '2013-03-28 23:49:00 UTC',
- )
- assert( ticket, "ticket created" )
- assert_equal( ticket.title, 'some title äöüß', 'ticket.title verify' )
- assert_equal( ticket.group.name, 'Users', 'ticket.group verify' )
- assert_equal( ticket.state.name, 'new', 'ticket.state verify' )
- # create inbound article
- article_inbound = Ticket::Article.create(
- :ticket_id => ticket.id,
- :from => 'some_sender@example.com',
- :to => 'some_recipient@example.com',
- :subject => 'some subject',
- :message_id => 'some@id',
- :body => 'some message',
- :internal => false,
- :sender => Ticket::Article::Sender.where(:name => 'Customer').first,
- :type => Ticket::Article::Type.where(:name => 'email').first,
- :updated_by_id => 1,
- :created_by_id => 1,
- :created_at => '2013-03-28 23:49:00 UTC',
- :updated_at => '2013-03-28 23:49:00 UTC',
- )
- ticket = Ticket.find(ticket.id)
- assert_equal( ticket.article_count, 1, 'ticket.article_count verify - inbound' )
- assert_equal( ticket.last_contact.to_s, article_inbound.created_at.to_s, 'ticket.last_contact verify - inbound' )
- assert_equal( ticket.last_contact_customer.to_s, article_inbound.created_at.to_s, 'ticket.last_contact_customer verify - inbound' )
- assert_equal( ticket.last_contact_agent, nil, 'ticket.last_contact_agent verify - inbound' )
- assert_equal( ticket.first_response, nil, 'ticket.first_response verify - inbound' )
- assert_equal( ticket.close_time, nil, 'ticket.close_time verify - inbound' )
- # create outbound article
- article_outbound = Ticket::Article.create(
- :ticket_id => ticket.id,
- :from => 'some_recipient@example.com',
- :to => 'some_sender@example.com',
- :subject => 'some subject',
- :message_id => 'some@id2',
- :body => 'some message 2',
- :internal => false,
- :sender => Ticket::Article::Sender.where(:name => 'Agent').first,
- :type => Ticket::Article::Type.where(:name => 'email').first,
- :updated_by_id => 1,
- :created_by_id => 1,
- :created_at => '2013-03-29 08:00:03 UTC',
- :updated_at => '2013-03-29 08:00:03 UTC',
- )
- ticket = Ticket.find(ticket.id)
- assert_equal( ticket.article_count, 2, 'ticket.article_count verify - outbound' )
- assert_equal( ticket.last_contact.to_s, article_outbound.created_at.to_s, 'ticket.last_contact verify - outbound' )
- assert_equal( ticket.last_contact_customer.to_s, article_inbound.created_at.to_s, 'ticket.last_contact_customer verify - outbound' )
- assert_equal( ticket.last_contact_agent.to_s, article_outbound.created_at.to_s, 'ticket.last_contact_agent verify - outbound' )
- assert_equal( ticket.first_response.to_s, article_outbound.created_at.to_s, 'ticket.first_response verify - outbound' )
- assert_equal( ticket.first_response_in_min, 0, 'ticket.first_response_in_min verify - outbound' )
- assert_equal( ticket.first_response_diff_in_min, 60, 'ticket.first_response_diff_in_min verify - outbound' )
- assert_equal( ticket.close_time, nil, 'ticket.close_time verify - outbound' )
- delete = ticket.destroy
- assert( delete, "ticket destroy" )
- ticket = Ticket.create(
- :title => 'some title äöüß',
- :group => Group.lookup( :name => 'Users'),
- :customer_id => 2,
- :state => Ticket::State.lookup( :name => 'new' ),
- :priority => Ticket::Priority.lookup( :name => '2 normal' ),
- :updated_by_id => 1,
- :created_by_id => 1,
- :created_at => '2013-03-28 23:49:00 UTC',
- :updated_at => '2013-03-28 23:49:00 UTC',
- )
- assert( ticket, "ticket created" )
- assert_equal( ticket.title, 'some title äöüß', 'ticket.title verify' )
- assert_equal( ticket.group.name, 'Users', 'ticket.group verify' )
- assert_equal( ticket.state.name, 'new', 'ticket.state verify' )
- # create inbound article
- article_inbound = Ticket::Article.create(
- :ticket_id => ticket.id,
- :from => 'some_sender@example.com',
- :subject => 'some subject',
- :message_id => 'some@id',
- :body => 'some message',
- :internal => false,
- :sender => Ticket::Article::Sender.where(:name => 'Customer').first,
- :type => Ticket::Article::Type.where(:name => 'phone').first,
- :updated_by_id => 1,
- :created_by_id => 1,
- :created_at => '2013-03-28 23:49:00 UTC',
- :updated_at => '2013-03-28 23:49:00 UTC',
- )
- ticket = Ticket.find(ticket.id)
- assert_equal( ticket.article_count, 1, 'ticket.article_count verify - inbound' )
- assert_equal( ticket.last_contact.to_s, article_inbound.created_at.to_s, 'ticket.last_contact verify - inbound' )
- assert_equal( ticket.last_contact_customer.to_s, article_inbound.created_at.to_s, 'ticket.last_contact_customer verify - inbound' )
- assert_equal( ticket.last_contact_agent, nil, 'ticket.last_contact_agent verify - inbound' )
- assert_equal( ticket.first_response.to_s, article_inbound.created_at.to_s, 'ticket.first_response verify - inbound' )
- assert_equal( ticket.close_time, nil, 'ticket.close_time verify - inbound' )
- delete = sla.destroy
- assert( delete, "sla destroy" )
- delete = sla.destroy
- assert( delete, "sla destroy" )
- end
- test 'ticket sla + timezone' do
- # cleanup
- delete = Sla.destroy_all
- assert( delete, "sla destroy_all" )
- delete = Ticket.destroy_all
- assert( delete, "ticket destroy_all" )
- ticket = Ticket.create(
- :title => 'some title äöüß',
- :group => Group.lookup( :name => 'Users'),
- :customer_id => 2,
- :state => Ticket::State.lookup( :name => 'new' ),
- :priority => Ticket::Priority.lookup( :name => '2 normal' ),
- :created_at => '2013-03-21 09:30:00 UTC',
- :updated_at => '2013-03-21 09:30:00 UTC',
- :updated_by_id => 1,
- :created_by_id => 1,
- )
- assert( ticket, "ticket created" )
- 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
- sla = Sla.create(
- :name => 'test sla 1',
- :condition => {},
- :data => {
- "Mon"=>"Mon", "Tue"=>"Tue", "Wed"=>"Wed", "Thu"=>"Thu", "Fri"=>"Fri", "Sat"=>"Sat", "Sun"=>"Sun",
- "beginning_of_workday" => "9:00",
- "end_of_workday" => "18:00",
- },
- :timezone => 'Europe/Berlin',
- :first_response_time => 120,
- :update_time => 180,
- :close_time => 240,
- :active => true,
- :updated_by_id => 1,
- :created_by_id => 1,
- )
- 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.first_response_escal_date.gmtime.to_s, '2013-03-21 11:30:00 UTC', 'ticket.first_response_escal_date verify 1' )
- assert_equal( ticket.update_time_escal_date.gmtime.to_s, '2013-03-21 12:30:00 UTC', 'ticket.update_time_escal_date verify 1' )
- assert_equal( ticket.close_time_escal_date.gmtime.to_s, '2013-03-21 13:30:00 UTC', 'ticket.close_time_escal_date verify 1' )
- delete = sla.destroy
- assert( delete, "sla destroy" )
- delete = ticket.destroy
- assert( delete, "ticket destroy" )
- ticket = Ticket.create(
- :title => 'some title äöüß',
- :group => Group.lookup( :name => 'Users'),
- :customer_id => 2,
- :state => Ticket::State.lookup( :name => 'new' ),
- :priority => Ticket::Priority.lookup( :name => '2 normal' ),
- :created_at => '2013-10-21 09:30:00 UTC',
- :updated_at => '2013-10-21 09:30:00 UTC',
- :updated_by_id => 1,
- :created_by_id => 1,
- )
- assert( ticket, "ticket created" )
- 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
- sla = Sla.create(
- :name => 'test sla 1',
- :condition => {},
- :data => {
- "Mon"=>"Mon", "Tue"=>"Tue", "Wed"=>"Wed", "Thu"=>"Thu", "Fri"=>"Fri", "Sat"=>"Sat", "Sun"=>"Sun",
- "beginning_of_workday" => "9:00",
- "end_of_workday" => "18:00",
- },
- :timezone => 'Europe/Berlin',
- :first_response_time => 120,
- :update_time => 180,
- :close_time => 240,
- :active => true,
- :updated_by_id => 1,
- :created_by_id => 1,
- )
- 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.first_response_escal_date.gmtime.to_s, '2013-10-21 11:30:00 UTC', 'ticket.first_response_escal_date verify 1' )
- assert_equal( ticket.update_time_escal_date.gmtime.to_s, '2013-10-21 12:30:00 UTC', 'ticket.update_time_escal_date verify 1' )
- assert_equal( ticket.close_time_escal_date.gmtime.to_s, '2013-10-21 13:30:00 UTC', 'ticket.close_time_escal_date verify 1' )
- delete = ticket.destroy
- assert( delete, "ticket destroy" )
- delete = sla.destroy
- assert( delete, "sla destroy" )
- ticket = Ticket.create(
- :title => 'some title äöüß',
- :group => Group.lookup( :name => 'Users'),
- :customer_id => 2,
- :state => Ticket::State.lookup( :name => 'new' ),
- :priority => Ticket::Priority.lookup( :name => '2 normal' ),
- :created_at => '2013-10-21 06:30:00 UTC',
- :updated_at => '2013-10-21 06:30:00 UTC',
- :updated_by_id => 1,
- :created_by_id => 1,
- )
- assert( ticket, "ticket created" )
- 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
- sla = Sla.create(
- :name => 'test sla 1',
- :condition => {},
- :data => {
- "Mon"=>"Mon", "Tue"=>"Tue", "Wed"=>"Wed", "Thu"=>"Thu", "Fri"=>"Fri", "Sat"=>"Sat", "Sun"=>"Sun",
- "beginning_of_workday" => "9:00",
- "end_of_workday" => "18:00",
- },
- :timezone => 'Europe/Berlin',
- :first_response_time => 120,
- :update_time => 180,
- :close_time => 240,
- :active => true,
- :updated_by_id => 1,
- :created_by_id => 1,
- )
- 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.first_response_escal_date.gmtime.to_s, '2013-10-21 09:00:00 UTC', 'ticket.first_response_escal_date verify 1' )
- assert_equal( ticket.update_time_escal_date.gmtime.to_s, '2013-10-21 10:00:00 UTC', 'ticket.update_time_escal_date verify 1' )
- assert_equal( ticket.close_time_escal_date.gmtime.to_s, '2013-10-21 11:00:00 UTC', 'ticket.close_time_escal_date verify 1' )
- delete = sla.destroy
- assert( delete, "sla destroy" )
- delete = ticket.destroy
- assert( delete, "ticket destroy" )
- end
- test 'ticket escalation suspend' do
- ticket = Ticket.create(
- :title => 'some title äöüß3',
- :group => Group.lookup( :name => 'Users'),
- :customer_id => 2,
- :state => Ticket::State.lookup( :name => 'new' ),
- :priority => Ticket::Priority.lookup( :name => '2 normal' ),
- :created_at => '2013-06-04 09:00:00 UTC',
- :updated_at => '2013-06-04 09:00:00 UTC',
- :updated_by_id => 1,
- :created_by_id => 1,
- )
- assert( ticket, 'ticket created' )
- # set ticket at 10:00 to pending
- History.add(
- :history_type => 'updated',
- :history_object => 'Ticket',
- :history_attribute => 'state',
- :o_id => ticket.id,
- :id_to => 3,
- :id_from => 2,
- :value_from => 'open',
- :value_to => 'pending',
- :created_by_id => 1,
- :created_at => '2013-06-04 10:00:00 UTC',
- :updated_at => '2013-06-04 10:00:00 UTC',
- )
- # set ticket at 10:30 to open
- History.add(
- :history_type => 'updated',
- :history_object => 'Ticket',
- :history_attribute => 'state',
- :o_id => ticket.id,
- :id_to => 2,
- :id_from => 3,
- :value_from => 'pending',
- :value_to => 'open',
- :created_by_id => 1,
- :created_at => '2013-06-04 10:30:00 UTC',
- :updated_at => '2013-06-04 10:30:00 UTC'
- )
- # set update time
- ticket.update_attributes(
- :last_contact_agent => '2013-06-04 10:15:00 UTC',
- )
- # set first response time
- ticket.update_attributes(
- :first_response => '2013-06-04 10:45:00 UTC',
- )
- # set ticket from 11:30 to closed
- History.add(
- :history_type => 'updated',
- :history_object => 'Ticket',
- :history_attribute => 'state',
- :o_id => ticket.id,
- :id_to => 3,
- :id_from => 2,
- :value_from => 'open',
- :value_to => 'closed',
- :created_by_id => 1,
- :created_at => '2013-06-04 12:00:00 UTC',
- :updated_at => '2013-06-04 12:00:00 UTC'
- )
- ticket.update_attributes(
- :close_time => '2013-06-04 12:00:00 UTC',
- )
- # set sla's for timezone "Europe/Berlin" summertime (+2), so UTC times are 7:00-16:00
- sla = Sla.create(
- :name => 'test sla 1',
- :condition => {},
- :data => {
- "Mon"=>"Mon", "Tue"=>"Tue", "Wed"=>"Wed", "Thu"=>"Thu", "Fri"=>"Fri", "Sat"=>"Sat", "Sun"=>"Sun",
- "beginning_of_workday" => "9:00",
- "end_of_workday" => "18:00",
- },
- :timezone => 'Europe/Berlin',
- :first_response_time => 120,
- :update_time => 180,
- :close_time => 250,
- :active => true,
- :updated_by_id => 1,
- :created_by_id => 1,
- )
- 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.first_response_escal_date.gmtime.to_s, '2013-06-04 11:30:00 UTC', 'ticket.first_response_escal_date verify 1' )
- assert_equal( ticket.first_response_in_min, 75, 'ticket.first_response_in_min verify 3' )
- assert_equal( ticket.first_response_diff_in_min, 45, 'ticket.first_response_diff_in_min verify 3' )
- assert_equal( ticket.update_time_escal_date.gmtime.to_s, '2013-06-04 13:30:00 UTC', 'ticket.update_time_escal_date verify 1' )
- assert_equal( ticket.close_time_escal_date.gmtime.to_s, '2013-06-04 13:40:00 UTC', 'ticket.close_time_escal_date verify 1' )
- assert_equal( ticket.close_time_in_min, 150, 'ticket.close_time_in_min verify 3' )
- assert_equal( ticket.close_time_diff_in_min, 100, 'ticket.close_time_diff_in_min# verify 3' )
- delete = sla.destroy
- assert( delete, "sla destroy" )
- delete = ticket.destroy
- assert( delete, "ticket destroy" )
- # test Ticket created in state pending and closed without reopen or state change
- ticket = Ticket.create(
- :title => 'some title äöüß3',
- :group => Group.lookup( :name => 'Users'),
- :customer_id => 2,
- :state => Ticket::State.lookup( :name => 'pending' ),
- :priority => Ticket::Priority.lookup( :name => '2 normal' ),
- :created_at => '2013-06-04 09:00:00 UTC',
- :updated_at => '2013-06-04 09:00:00 UTC',
- :updated_by_id => 1,
- :created_by_id => 1,
- )
- assert( ticket, 'ticket created' )
- # set ticket from 11:30 to closed
- History.add(
- :history_type => 'updated',
- :history_object => 'Ticket',
- :history_attribute => 'state',
- :o_id => ticket.id,
- :id_to => 4,
- :id_from => 3,
- :value_from => 'pending',
- :value_to => 'closed',
- :created_by_id => 1,
- :created_at => '2013-06-04 12:00:00 UTC',
- :updated_at => '2013-06-04 12:00:00 UTC',
- )
- ticket.update_attributes(
- :close_time => '2013-06-04 12:00:00 UTC',
- )
- sla = Sla.create(
- :name => 'test sla 1',
- :condition => {},
- :data => {
- "Mon"=>"Mon", "Tue"=>"Tue", "Wed"=>"Wed", "Thu"=>"Thu", "Fri"=>"Fri", "Sat"=>"Sat", "Sun"=>"Sun",
- "beginning_of_workday" => "9:00",
- "end_of_workday" => "18:00",
- },
- :first_response_time => 120,
- :update_time => 180,
- :close_time => 240,
- :active => true,
- :updated_by_id => 1,
- :created_by_id => 1,
- )
- ticket = Ticket.find(ticket.id)
- assert_equal( ticket.escalation_time.gmtime.to_s, '2013-06-04 14:00:00 UTC', 'ticket.escalation_time verify 1' )
- assert_equal( ticket.first_response_escal_date.gmtime.to_s, '2013-06-04 14:00:00 UTC', 'ticket.first_response_escal_date verify 1' )
- assert_equal( ticket.first_response_in_min, nil, 'ticket.first_response_in_min verify 3' )
- assert_equal( ticket.first_response_diff_in_min, nil, 'ticket.first_response_diff_in_min verify 3' )
- assert_equal( ticket.update_time_escal_date.gmtime.to_s, '2013-06-04 15:00:00 UTC', 'ticket.update_time_escal_date verify 1' )
- assert_equal( ticket.close_time_escal_date.gmtime.to_s, '2013-06-04 16:00:00 UTC', 'ticket.close_time_escal_date verify 1' )
- assert_equal( ticket.close_time_in_min, 0, 'ticket.close_time_in_min verify 3' )
- assert_equal( ticket.close_time_diff_in_min, 240, 'ticket.close_time_diff_in_min# verify 3' )
- delete = sla.destroy
- assert( delete, "sla destroy" )
- delete = ticket.destroy
- assert( delete, "ticket destroy" )
- # test Ticket created in state pending, changed state to openen, back to pending and closed
- ticket = Ticket.create(
- :title => 'some title äöüß3',
- :group => Group.lookup( :name => 'Users'),
- :customer_id => 2,
- :state => Ticket::State.lookup( :name => 'pending' ),
- :priority => Ticket::Priority.lookup( :name => '2 normal' ),
- :created_at => '2013-06-04 09:00:00 UTC',
- :updated_at => '2013-06-04 09:00:00 UTC',
- :updated_by_id => 1,
- :created_by_id => 1,
- )
- assert( ticket, 'ticket created' )
- # state change to open 10:30
- History.add(
- :history_type => 'updated',
- :history_object => 'Ticket',
- :history_attribute => 'state',
- :o_id => ticket.id,
- :id_to => 2,
- :id_from => 3,
- :value_from => 'pending',
- :value_to => 'open',
- :created_by_id => 1,
- :created_at => '2013-06-04 10:30:00 UTC',
- :updated_at => '2013-06-04 10:30:00 UTC',
- )
- # state change to pending 11:00
- History.add(
- :history_type => 'updated',
- :history_object => 'Ticket',
- :history_attribute => 'state',
- :o_id => ticket.id,
- :id_to => 3,
- :id_from => 2,
- :value_from => 'open',
- :value_to => 'pending',
- :created_by_id => 1,
- :created_at => '2013-06-04 11:00:00 UTC',
- :updated_at => '2013-06-04 11:00:00 UTC',
- )
- # set ticket from 12:00 to closed
- History.add(
- :history_type => 'updated',
- :history_object => 'Ticket',
- :history_attribute => 'state',
- :o_id => ticket.id,
- :id_to => 4,
- :id_from => 3,
- :value_from => 'pending',
- :value_to => 'closed',
- :created_by_id => 1,
- :created_at => '2013-06-04 12:00:00 UTC',
- :updated_at => '2013-06-04 12:00:00 UTC',
- )
- ticket.update_attributes(
- :close_time => '2013-06-04 12:00:00 UTC',
- )
- sla = Sla.create(
- :name => 'test sla 1',
- :condition => {},
- :data => {
- "Mon"=>"Mon", "Tue"=>"Tue", "Wed"=>"Wed", "Thu"=>"Thu", "Fri"=>"Fri", "Sat"=>"Sat", "Sun"=>"Sun",
- "beginning_of_workday" => "9:00",
- "end_of_workday" => "18:00",
- },
- :first_response_time => 120,
- :update_time => 180,
- :close_time => 240,
- :active => true,
- :updated_by_id => 1,
- :created_by_id => 1,
- )
- 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.first_response_escal_date.gmtime.to_s, '2013-06-04 13:30:00 UTC', 'ticket.first_response_escal_date verify 1' )
- assert_equal( ticket.first_response_in_min, nil, 'ticket.first_response_in_min verify 3' )
- assert_equal( ticket.first_response_diff_in_min, nil, 'ticket.first_response_diff_in_min verify 3' )
- assert_equal( ticket.update_time_escal_date.gmtime.to_s, '2013-06-04 14:30:00 UTC', 'ticket.update_time_escal_date verify 1' )
- assert_equal( ticket.close_time_escal_date.gmtime.to_s, '2013-06-04 15:30:00 UTC', 'ticket.close_time_escal_date verify 1' )
- assert_equal( ticket.close_time_in_min, 30, 'ticket.close_time_in_min verify 3' )
- assert_equal( ticket.close_time_diff_in_min, 210, 'ticket.close_time_diff_in_min# verify 3' )
- delete = sla.destroy
- assert( delete, "sla destroy" )
- delete = ticket.destroy
- assert( delete, "ticket destroy" )
- ### Test Ticket created in state pending, changed state to openen, back to pending and back to open then
- ### close ticket
- ticket = Ticket.create(
- :title => 'some title äöüß3',
- :group => Group.lookup( :name => 'Users'),
- :customer_id => 2,
- :state => Ticket::State.lookup( :name => 'pending' ),
- :priority => Ticket::Priority.lookup( :name => '2 normal' ),
- :created_at => '2013-06-04 09:00:00 UTC',
- :updated_at => '2013-06-04 09:00:00 UTC',
- :updated_by_id => 1,
- :created_by_id => 1,
- )
- assert( ticket, 'ticket created' )
- # state change to open from pending
- History.add(
- :history_type => 'updated',
- :history_object => 'Ticket',
- :history_attribute => 'state',
- :o_id => ticket.id,
- :id_to => 2,
- :id_from => 3,
- :value_from => 'pending',
- :value_to => 'open',
- :created_by_id => 1,
- :created_at => '2013-06-04 10:30:00 UTC',
- :updated_at => '2013-06-04 10:30:00 UTC',
- )
- # state change to pending from open 11:00
- History.add(
- :history_type => 'updated',
- :history_object => 'Ticket',
- :history_attribute => 'state',
- :o_id => ticket.id,
- :id_to => 3,
- :id_from => 2,
- :value_from => 'open',
- :value_to => 'pending',
- :created_by_id => 1,
- :created_at => '2013-06-04 11:00:00 UTC',
- :updated_at => '2013-06-04 11:00:00 UTC',
- )
- # state change to open 11:30
- History.add(
- :history_type => 'updated',
- :history_object => 'Ticket',
- :history_attribute => 'state',
- :o_id => ticket.id,
- :id_to => 2,
- :id_from => 3,
- :value_from => 'pending',
- :value_to => 'open',
- :created_by_id => 1,
- :created_at => '2013-06-04 11:30:00 UTC',
- :updated_at => '2013-06-04 11:30:00 UTC',
- )
- # set ticket from open to closed 12:00
- History.add(
- :history_type => 'updated',
- :history_object => 'Ticket',
- :history_attribute => 'state',
- :o_id => ticket.id,
- :id_to => 4,
- :id_from => 3,
- :value_from => 'open',
- :value_to => 'closed',
- :created_by_id => 1,
- :created_at => '2013-06-04 12:00:00 UTC',
- :updated_at => '2013-06-04 12:00:00 UTC',
- )
- ticket.update_attributes(
- :close_time => '2013-06-04 12:00:00 UTC',
- )
- sla = Sla.create(
- :name => 'test sla 1',
- :condition => {},
- :data => {
- "Mon"=>"Mon", "Tue"=>"Tue", "Wed"=>"Wed", "Thu"=>"Thu", "Fri"=>"Fri", "Sat"=>"Sat", "Sun"=>"Sun",
- "beginning_of_workday" => "9:00",
- "end_of_workday" => "18:00",
- },
- :first_response_time => 120,
- :update_time => 180,
- :close_time => 240,
- :active => true,
- :updated_by_id => 1,
- :created_by_id => 1,
- )
- ticket = Ticket.find(ticket.id)
- assert_equal( ticket.escalation_time.gmtime.to_s, '2013-06-04 13:00:00 UTC', 'ticket.escalation_time verify 1' )
- assert_equal( ticket.first_response_escal_date.gmtime.to_s, '2013-06-04 13:00:00 UTC', 'ticket.first_response_escal_date verify 1' )
- assert_equal( ticket.first_response_in_min, nil, 'ticket.first_response_in_min verify 3' )
- assert_equal( ticket.first_response_diff_in_min, nil, 'ticket.first_response_diff_in_min verify 3' )
- assert_equal( ticket.update_time_escal_date.gmtime.to_s, '2013-06-04 14:00:00 UTC', 'ticket.update_time_escal_date verify 1' )
- assert_equal( ticket.close_time_escal_date.gmtime.to_s, '2013-06-04 15:00:00 UTC', 'ticket.close_time_escal_date verify 1' )
- assert_equal( ticket.close_time_in_min, 60, 'ticket.close_time_in_min verify 3' )
- assert_equal( ticket.close_time_diff_in_min, 180, 'ticket.close_time_diff_in_min# verify 3' )
- delete = sla.destroy
- assert( delete, "sla destroy" )
- delete = ticket.destroy
- assert( delete, "ticket destroy" )
- end
- end
|