Merge pull request #1879 from internetee/tara-key-fix

Fix CookieOverflow error using current Tara test keys
This commit is contained in:
Timo Võhmar 2021-03-11 15:57:20 +02:00 committed by GitHub
commit c521bc240e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 20 additions and 2 deletions

View file

@ -34,6 +34,18 @@ class TaraUsersTest < ApplicationSystemTestCase
assert_text('Signed in successfully')
end
def test_existing_user_logs_in_without_cookie_overflow
@existing_user_hash['credentials'] = massive_hash
OmniAuth.config.mock_auth[:tara] = OmniAuth::AuthHash.new(@existing_user_hash)
visit new_registrar_user_session_path
assert_nothing_raised do
click_link('Sign in')
end
assert_text('Signed in successfully')
end
def test_nonexisting_user_gets_error_message
OmniAuth.config.mock_auth[:tara] = OmniAuth::AuthHash.new(@new_user_hash)
@ -42,4 +54,10 @@ class TaraUsersTest < ApplicationSystemTestCase
assert_text('No such user')
end
def massive_hash
o = [('a'..'z'), ('A'..'Z')].map(&:to_a).flatten
string = (0...5000).map { o[rand(o.length)] }.join
{"access_token":"AT-540-Fj5gbPvJp4jPkO-4EdgzIhIhhJapoRTM","token_type":"bearer","expires_in":600,"id_token":string}
end
end