session_basic_ticket_test.rb 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. # encoding: utf-8
  2. require 'test_helper'
  3. class SessionBasicTicketTest < ActiveSupport::TestCase
  4. test 'b ticket_overview_index' do
  5. UserInfo.current_user_id = 1
  6. user = User.lookup(:id => 1)
  7. client1 = Sessions::Backend::TicketOverviewIndex.new(user, false, '123-1')
  8. # get as stream
  9. result1 = client1.push
  10. assert( result1, "check ticket_overview_index" )
  11. sleep 1
  12. # next check should be empty
  13. result1 = client1.push
  14. assert( !result1, "check ticket_overview_index - recall" )
  15. # next check should be empty
  16. sleep 10
  17. result1 = client1.push
  18. assert( !result1, "check ticket_overview_index - recall 2" )
  19. ticket = Ticket.create( :title => '12323', :group_id => 1, :priority_id => 1, :state_id => 1, :customer_id => 1 )
  20. sleep 10
  21. # get as stream
  22. result1 = client1.push
  23. assert( result1, "check ticket_overview_index - recall 3" )
  24. end
  25. test 'b ticket_overview_list' do
  26. UserInfo.current_user_id = 1
  27. user = User.lookup(:id => 1)
  28. client1 = Sessions::Backend::TicketOverviewList.new(user, false, '123-1')
  29. # get as stream
  30. result1 = client1.push
  31. assert( result1, "check ticket_overview_list" )
  32. sleep 1
  33. # next check should be empty
  34. result1 = client1.push
  35. assert( !result1, "check ticket_overview_list - recall" )
  36. # next check should be empty
  37. sleep 10
  38. result1 = client1.push
  39. assert( !result1, "check ticket_overview_list - recall 2" )
  40. ticket = Ticket.create( :title => '12323', :group_id => 1, :priority_id => 1, :state_id => 1, :customer_id => 1 )
  41. sleep 10
  42. # get as stream
  43. result1 = client1.push
  44. assert( result1, "check ticket_overview_list - recall 3" )
  45. end
  46. end