diff --git a/test/test_helper.rb b/test/test_helper.rb index 842ef3fa4..087ac1313 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -23,6 +23,9 @@ class ActiveSupport::TestCase # load seeds load "#{Rails.root}/db/seeds.rb" + # set system mode to done / to activate + Setting.set('system_init_done', true) + setup do # set current user diff --git a/test/unit/session_basic_test.rb b/test/unit/session_basic_test.rb index 0b3a843a1..7356df3b2 100644 --- a/test/unit/session_basic_test.rb +++ b/test/unit/session_basic_test.rb @@ -227,7 +227,7 @@ class SessionBasicTest < ActiveSupport::TestCase :groups => groups, ) agent1.roles = roles - agent1.save + assert( agent1.save, "create/update agent1" ) as_client1 = Sessions::Backend::ActivityStream.new(agent1, false, '123-1') diff --git a/test/unit/session_basic_ticket_test.rb b/test/unit/session_basic_ticket_test.rb index 915bea00f..c74a3f4b4 100644 --- a/test/unit/session_basic_ticket_test.rb +++ b/test/unit/session_basic_ticket_test.rb @@ -4,8 +4,26 @@ require 'test_helper' class SessionBasicTicketTest < ActiveSupport::TestCase test 'b ticket_overview_index' do - UserInfo.current_user_id = 2 - user = User.lookup(:id => 1) + UserInfo.current_user_id = 1 + + # create users + roles = Role.where( :name => [ 'Agent' ] ) + groups = Group.all + + agent1 = User.create_or_update( + :login => 'activity-stream-agent-1', + :firstname => 'Session', + :lastname => 'activity stream ' + rand(99999).to_s, + :email => 'activity-stream-agent1@example.com', + :password => 'agentpw', + :active => true, + :roles => roles, + :groups => groups, + ) + agent1.roles = roles + assert( agent1.save, "create/update agent1" ) + + user = User.lookup( :id => agent1.id ) client1 = Sessions::Backend::TicketOverviewIndex.new(user, false, '123-1') # get as stream @@ -33,8 +51,27 @@ class SessionBasicTicketTest < ActiveSupport::TestCase test 'b ticket_overview_list' do - UserInfo.current_user_id = 2 - user = User.lookup(:id => 1) + UserInfo.current_user_id = 1 + + # create users + roles = Role.where( :name => [ 'Agent' ] ) + groups = Group.all + + agent1 = User.create_or_update( + :login => 'activity-stream-agent-1', + :firstname => 'Session', + :lastname => 'activity stream ' + rand(99999).to_s, + :email => 'activity-stream-agent1@example.com', + :password => 'agentpw', + :active => true, + :roles => roles, + :groups => groups, + ) + agent1.roles = roles + assert( agent1.save, "create/update agent1" ) + + user = User.lookup( :id => agent1.id ) + client1 = Sessions::Backend::TicketOverviewList.new(user, false, '123-1') # get as stream