Support mt6 style.

This commit is contained in:
Martin Edenhofer 2017-05-02 22:58:56 +02:00
parent 10b11cb726
commit 764784908f
4 changed files with 17 additions and 14 deletions

View file

@ -72,6 +72,8 @@ class AuthTest < ActiveSupport::TestCase
assert_equal(user[key], value, 'verify')
}
end
elsif test[:result].nil?
assert_nil(user, 'failed or not existing')
else
assert_equal(test[:result], user, 'failed or not existing')
end

View file

@ -1083,7 +1083,11 @@ end
#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))
else
assert_equal(file[:params][key.to_sym], data[key.to_sym], "check #{key}")
if file[:params][key.to_sym] == nil
assert_nil(data[key.to_sym], "check #{key}")
else
assert_equal(file[:params][key.to_sym], data[key.to_sym], "check #{key}")
end
end
}

View file

@ -143,10 +143,9 @@ class SessionBasicTest < ActiveSupport::TestCase
# check again after touch
result1 = collection_client1.push
assert(!result1, 'check collections - after touch - recall')
assert_nil(result1, 'check collections - after touch - recall')
result2 = collection_client2.push
assert(!result2, 'check collections - after touch - recall')
assert_equal(result1, result2, 'check collections')
assert_nil(result2, 'check collections - after touch - recall')
# change collection
group = Group.create(name: "SomeGroup::#{rand(999_999)}", active: true)
@ -162,10 +161,9 @@ class SessionBasicTest < ActiveSupport::TestCase
# check again after create
travel 4.seconds
result1 = collection_client1.push
assert(!result1, 'check collections - after create - recall')
assert_nil(result1, 'check collections - after create - recall')
result2 = collection_client2.push
assert(!result2, 'check collections - after create - recall')
assert_equal(result1, result2, 'check collections')
assert_nil(result2, 'check collections - after create - recall')
# change collection
group.destroy
@ -181,10 +179,9 @@ class SessionBasicTest < ActiveSupport::TestCase
# check again after destroy
travel 4.seconds
result1 = collection_client1.push
assert(!result1, 'check collections - after destroy - recall')
assert_nil(result1, 'check collections - after destroy - recall')
result2 = collection_client2.push
assert(!result2, 'check collections - after destroy - recall')
assert_equal(result1, result2, 'check collections')
assert_nil(result2, 'check collections - after destroy - recall')
travel_back
end

View file

@ -175,7 +175,7 @@ class SessionCollectionsTest < ActiveSupport::TestCase
test 'b assets' do
# create users
roles = Role.where(name: %w(Agent Admin))
groups = Group.all
groups = Group.all.order(id: :asc)
UserInfo.current_user_id = 2
agent1 = User.create_or_update(
@ -193,19 +193,19 @@ class SessionCollectionsTest < ActiveSupport::TestCase
assets = {}
client1 = Sessions::Backend::Collections::Group.new(agent1, assets, false, '123-1', 4)
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])
travel 10.seconds
client1 = Sessions::Backend::Collections::Group.new(agent1, assets, false, '123-1', 4)
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])
travel 2.minutes
client1 = Sessions::Backend::Collections::Group.new(agent1, assets, false, '123-1', 4)
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])
travel 10.seconds