Improved code layout.

This commit is contained in:
Martin Edenhofer 2014-11-14 02:48:30 +01:00
parent be5e0b1a5c
commit 27885a097e

View file

@ -10,38 +10,38 @@ class SessionEnhancedTest < ActiveSupport::TestCase
UserInfo.current_user_id = 1 UserInfo.current_user_id = 1
agent1 = User.create_or_update( agent1 = User.create_or_update(
:login => 'session-agent-1', :login => 'session-agent-1',
:firstname => 'Session', :firstname => 'Session',
:lastname => 'Agent 1', :lastname => 'Agent 1',
:email => 'session-agent1@example.com', :email => 'session-agent1@example.com',
:password => 'agentpw', :password => 'agentpw',
:active => true, :active => true,
:roles => roles, :roles => roles,
:groups => groups, :groups => groups,
) )
agent1.roles = roles agent1.roles = roles
agent1.save agent1.save
agent2 = User.create_or_update( agent2 = User.create_or_update(
:login => 'session-agent-2', :login => 'session-agent-2',
:firstname => 'Session', :firstname => 'Session',
:lastname => 'Agent 2', :lastname => 'Agent 2',
:email => 'session-agent2@example.com', :email => 'session-agent2@example.com',
:password => 'agentpw', :password => 'agentpw',
:active => true, :active => true,
:roles => roles, :roles => roles,
:groups => groups, :groups => groups,
) )
agent2.roles = roles agent2.roles = roles
agent2.save agent2.save
agent3 = User.create_or_update( agent3 = User.create_or_update(
:login => 'session-agent-3', :login => 'session-agent-3',
:firstname => 'Session', :firstname => 'Session',
:lastname => 'Agent 3', :lastname => 'Agent 3',
:email => 'session-agent3@example.com', :email => 'session-agent3@example.com',
:password => 'agentpw', :password => 'agentpw',
:active => true, :active => true,
:roles => roles, :roles => roles,
:groups => groups, :groups => groups,
) )
agent3.roles = roles agent3.roles = roles
agent3.save agent3.save
@ -182,26 +182,26 @@ class SessionEnhancedTest < ActiveSupport::TestCase
UserInfo.current_user_id = 1 UserInfo.current_user_id = 1
agent1 = User.create_or_update( agent1 = User.create_or_update(
:login => 'session-agent-1', :login => 'session-agent-1',
:firstname => 'Session', :firstname => 'Session',
:lastname => 'Agent 1', :lastname => 'Agent 1',
:email => 'session-agent1@example.com', :email => 'session-agent1@example.com',
:password => 'agentpw', :password => 'agentpw',
:active => true, :active => true,
:roles => roles, :roles => roles,
:groups => groups, :groups => groups,
) )
agent1.roles = roles agent1.roles = roles
agent1.save agent1.save
agent2 = User.create_or_update( agent2 = User.create_or_update(
:login => 'session-agent-2', :login => 'session-agent-2',
:firstname => 'Session', :firstname => 'Session',
:lastname => 'Agent 2', :lastname => 'Agent 2',
:email => 'session-agent2@example.com', :email => 'session-agent2@example.com',
:password => 'agentpw', :password => 'agentpw',
:active => true, :active => true,
:roles => roles, :roles => roles,
:groups => groups, :groups => groups,
) )
agent2.roles = roles agent2.roles = roles
agent2.save agent2.save
@ -210,7 +210,7 @@ class SessionEnhancedTest < ActiveSupport::TestCase
# create sessions # create sessions
client_id1_0 = '1234-1' client_id1_0 = '1234-1'
client_id1_1 = '1234-2' client_id1_1 = '1234-2'
client_id2 = '123456' client_id2 = '123456'
Sessions.destory(client_id1_0) Sessions.destory(client_id1_0)
Sessions.destory(client_id1_1) Sessions.destory(client_id1_1)
Sessions.destory(client_id2) Sessions.destory(client_id2)
@ -234,18 +234,18 @@ class SessionEnhancedTest < ActiveSupport::TestCase
# check collections # check collections
collections = { collections = {
'Group' => true, 'Group' => true,
'Organization' => true, 'Organization' => true,
'User' => nil, 'User' => nil,
} }
check_if_collection_reset_message_exists(client_id1_0, collections, 'init') check_if_collection_reset_message_exists(client_id1_0, collections, 'init')
check_if_collection_reset_message_exists(client_id1_1, collections, 'init') check_if_collection_reset_message_exists(client_id1_1, collections, 'init')
check_if_collection_reset_message_exists(client_id2, collections, 'init') check_if_collection_reset_message_exists(client_id2, collections, 'init')
collections = { collections = {
'Group' => nil, 'Group' => nil,
'Organization' => nil, 'Organization' => nil,
'User' => nil, 'User' => nil,
} }
check_if_collection_reset_message_exists(client_id1_0, collections, 'init2') check_if_collection_reset_message_exists(client_id1_0, collections, 'init2')
check_if_collection_reset_message_exists(client_id1_1, collections, 'init2') check_if_collection_reset_message_exists(client_id1_1, collections, 'init2')
@ -254,9 +254,9 @@ class SessionEnhancedTest < ActiveSupport::TestCase
sleep 20 sleep 20
collections = { collections = {
'Group' => nil, 'Group' => nil,
'Organization' => nil, 'Organization' => nil,
'User' => nil, 'User' => nil,
} }
check_if_collection_reset_message_exists(client_id1_0, collections, 'init3') check_if_collection_reset_message_exists(client_id1_0, collections, 'init3')
check_if_collection_reset_message_exists(client_id1_1, collections, 'init3') check_if_collection_reset_message_exists(client_id1_1, collections, 'init3')
@ -270,9 +270,9 @@ class SessionEnhancedTest < ActiveSupport::TestCase
# check collections # check collections
collections = { collections = {
'Group' => true, 'Group' => true,
'Organization' => nil, 'Organization' => nil,
'User' => nil, 'User' => nil,
} }
check_if_collection_reset_message_exists(client_id1_0, collections, 'update') check_if_collection_reset_message_exists(client_id1_0, collections, 'update')
check_if_collection_reset_message_exists(client_id1_1, collections, 'update') check_if_collection_reset_message_exists(client_id1_1, collections, 'update')