Fixed unit tests.

This commit is contained in:
Martin Edenhofer 2014-11-10 21:34:15 +01:00
parent 4cbdbc79c0
commit 79470e8ca5
3 changed files with 45 additions and 5 deletions

View file

@ -23,6 +23,9 @@ class ActiveSupport::TestCase
# load seeds # load seeds
load "#{Rails.root}/db/seeds.rb" load "#{Rails.root}/db/seeds.rb"
# set system mode to done / to activate
Setting.set('system_init_done', true)
setup do setup do
# set current user # set current user

View file

@ -227,7 +227,7 @@ class SessionBasicTest < ActiveSupport::TestCase
:groups => groups, :groups => groups,
) )
agent1.roles = roles agent1.roles = roles
agent1.save assert( agent1.save, "create/update agent1" )
as_client1 = Sessions::Backend::ActivityStream.new(agent1, false, '123-1') as_client1 = Sessions::Backend::ActivityStream.new(agent1, false, '123-1')

View file

@ -4,8 +4,26 @@ require 'test_helper'
class SessionBasicTicketTest < ActiveSupport::TestCase class SessionBasicTicketTest < ActiveSupport::TestCase
test 'b ticket_overview_index' do test 'b ticket_overview_index' do
UserInfo.current_user_id = 2 UserInfo.current_user_id = 1
user = User.lookup(: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') client1 = Sessions::Backend::TicketOverviewIndex.new(user, false, '123-1')
# get as stream # get as stream
@ -33,8 +51,27 @@ class SessionBasicTicketTest < ActiveSupport::TestCase
test 'b ticket_overview_list' do test 'b ticket_overview_list' do
UserInfo.current_user_id = 2 UserInfo.current_user_id = 1
user = User.lookup(: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') client1 = Sessions::Backend::TicketOverviewList.new(user, false, '123-1')
# get as stream # get as stream