Support mt6 style.
This commit is contained in:
parent
10b11cb726
commit
764784908f
4 changed files with 17 additions and 14 deletions
|
@ -72,6 +72,8 @@ class AuthTest < ActiveSupport::TestCase
|
||||||
assert_equal(user[key], value, 'verify')
|
assert_equal(user[key], value, 'verify')
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
elsif test[:result].nil?
|
||||||
|
assert_nil(user, 'failed or not existing')
|
||||||
else
|
else
|
||||||
assert_equal(test[:result], user, 'failed or not existing')
|
assert_equal(test[:result], user, 'failed or not existing')
|
||||||
end
|
end
|
||||||
|
|
|
@ -1082,9 +1082,13 @@ end
|
||||||
#puts '++' + data[:body].to_s + '++'
|
#puts '++' + data[:body].to_s + '++'
|
||||||
#puts '++' + file[:params][key.to_sym].to_s + '++'
|
#puts '++' + file[:params][key.to_sym].to_s + '++'
|
||||||
assert_equal(Digest::MD5.hexdigest(file[:params][key.to_sym].to_s), Digest::MD5.hexdigest(data[:body].to_s))
|
assert_equal(Digest::MD5.hexdigest(file[:params][key.to_sym].to_s), Digest::MD5.hexdigest(data[:body].to_s))
|
||||||
|
else
|
||||||
|
if file[:params][key.to_sym] == nil
|
||||||
|
assert_nil(data[key.to_sym], "check #{key}")
|
||||||
else
|
else
|
||||||
assert_equal(file[:params][key.to_sym], data[key.to_sym], "check #{key}")
|
assert_equal(file[:params][key.to_sym], data[key.to_sym], "check #{key}")
|
||||||
end
|
end
|
||||||
|
end
|
||||||
}
|
}
|
||||||
|
|
||||||
# check attachments
|
# check attachments
|
||||||
|
|
|
@ -143,10 +143,9 @@ class SessionBasicTest < ActiveSupport::TestCase
|
||||||
|
|
||||||
# check again after touch
|
# check again after touch
|
||||||
result1 = collection_client1.push
|
result1 = collection_client1.push
|
||||||
assert(!result1, 'check collections - after touch - recall')
|
assert_nil(result1, 'check collections - after touch - recall')
|
||||||
result2 = collection_client2.push
|
result2 = collection_client2.push
|
||||||
assert(!result2, 'check collections - after touch - recall')
|
assert_nil(result2, 'check collections - after touch - recall')
|
||||||
assert_equal(result1, result2, 'check collections')
|
|
||||||
|
|
||||||
# change collection
|
# change collection
|
||||||
group = Group.create(name: "SomeGroup::#{rand(999_999)}", active: true)
|
group = Group.create(name: "SomeGroup::#{rand(999_999)}", active: true)
|
||||||
|
@ -162,10 +161,9 @@ class SessionBasicTest < ActiveSupport::TestCase
|
||||||
# check again after create
|
# check again after create
|
||||||
travel 4.seconds
|
travel 4.seconds
|
||||||
result1 = collection_client1.push
|
result1 = collection_client1.push
|
||||||
assert(!result1, 'check collections - after create - recall')
|
assert_nil(result1, 'check collections - after create - recall')
|
||||||
result2 = collection_client2.push
|
result2 = collection_client2.push
|
||||||
assert(!result2, 'check collections - after create - recall')
|
assert_nil(result2, 'check collections - after create - recall')
|
||||||
assert_equal(result1, result2, 'check collections')
|
|
||||||
|
|
||||||
# change collection
|
# change collection
|
||||||
group.destroy
|
group.destroy
|
||||||
|
@ -181,10 +179,9 @@ class SessionBasicTest < ActiveSupport::TestCase
|
||||||
# check again after destroy
|
# check again after destroy
|
||||||
travel 4.seconds
|
travel 4.seconds
|
||||||
result1 = collection_client1.push
|
result1 = collection_client1.push
|
||||||
assert(!result1, 'check collections - after destroy - recall')
|
assert_nil(result1, 'check collections - after destroy - recall')
|
||||||
result2 = collection_client2.push
|
result2 = collection_client2.push
|
||||||
assert(!result2, 'check collections - after destroy - recall')
|
assert_nil(result2, 'check collections - after destroy - recall')
|
||||||
assert_equal(result1, result2, 'check collections')
|
|
||||||
travel_back
|
travel_back
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -175,7 +175,7 @@ class SessionCollectionsTest < ActiveSupport::TestCase
|
||||||
test 'b assets' do
|
test 'b assets' do
|
||||||
# create users
|
# create users
|
||||||
roles = Role.where(name: %w(Agent Admin))
|
roles = Role.where(name: %w(Agent Admin))
|
||||||
groups = Group.all
|
groups = Group.all.order(id: :asc)
|
||||||
|
|
||||||
UserInfo.current_user_id = 2
|
UserInfo.current_user_id = 2
|
||||||
agent1 = User.create_or_update(
|
agent1 = User.create_or_update(
|
||||||
|
@ -193,19 +193,19 @@ class SessionCollectionsTest < ActiveSupport::TestCase
|
||||||
assets = {}
|
assets = {}
|
||||||
client1 = Sessions::Backend::Collections::Group.new(agent1, assets, false, '123-1', 4)
|
client1 = Sessions::Backend::Collections::Group.new(agent1, assets, false, '123-1', 4)
|
||||||
data = client1.push
|
data = client1.push
|
||||||
assert(data[:collection][:Group][groups.first.id])
|
assert_equal(data[:collection][:Group][0]['id'], groups[0].id)
|
||||||
assert(data[:assets][:Group][groups.first.id])
|
assert(data[:assets][:Group][groups.first.id])
|
||||||
travel 10.seconds
|
travel 10.seconds
|
||||||
|
|
||||||
client1 = Sessions::Backend::Collections::Group.new(agent1, assets, false, '123-1', 4)
|
client1 = Sessions::Backend::Collections::Group.new(agent1, assets, false, '123-1', 4)
|
||||||
data = client1.push
|
data = client1.push
|
||||||
assert(data[:collection][:Group][groups.first.id])
|
assert_equal(data[:collection][:Group][0]['id'], groups[0].id)
|
||||||
assert(data[:assets][:Group][groups.first.id])
|
assert(data[:assets][:Group][groups.first.id])
|
||||||
|
|
||||||
travel 2.minutes
|
travel 2.minutes
|
||||||
client1 = Sessions::Backend::Collections::Group.new(agent1, assets, false, '123-1', 4)
|
client1 = Sessions::Backend::Collections::Group.new(agent1, assets, false, '123-1', 4)
|
||||||
data = client1.push
|
data = client1.push
|
||||||
assert(data[:collection][:Group][groups.first.id])
|
assert_equal(data[:collection][:Group][0]['id'], groups[0].id)
|
||||||
assert_nil(data[:assets][:Group])
|
assert_nil(data[:assets][:Group])
|
||||||
|
|
||||||
travel 10.seconds
|
travel 10.seconds
|
||||||
|
|
Loading…
Reference in a new issue