mirror of
https://github.com/internetee/registry.git
synced 2025-06-08 05:34:46 +02:00
Add test for registrant TARA integration
This commit is contained in:
parent
f892302e93
commit
ed29bef7f1
1 changed files with 49 additions and 0 deletions
49
test/models/registrant_user/tara/tara_users_test.rb
Normal file
49
test/models/registrant_user/tara/tara_users_test.rb
Normal file
|
@ -0,0 +1,49 @@
|
|||
require 'application_system_test_case'
|
||||
|
||||
class RegistrantAreaTaraUsersTest < ApplicationSystemTestCase
|
||||
def setup
|
||||
super
|
||||
|
||||
OmniAuth.config.test_mode = true
|
||||
@registrant = users(:registrant)
|
||||
|
||||
@existing_user_hash = {
|
||||
'provider' => 'rant_tara',
|
||||
'uid' => "US1234",
|
||||
'info': { 'first_name': 'Registrant', 'last_name': 'User' }
|
||||
}
|
||||
|
||||
@new_user_hash = {
|
||||
'provider' => 'rant_tara',
|
||||
'uid' => 'EE51007050604',
|
||||
'info': { 'first_name': 'New Registrant', 'last_name': 'User'}
|
||||
}
|
||||
end
|
||||
|
||||
def teardown
|
||||
super
|
||||
|
||||
OmniAuth.config.test_mode = false
|
||||
OmniAuth.config.mock_auth['rant_tara'] = nil
|
||||
end
|
||||
|
||||
def test_existing_user_gets_signed_in
|
||||
OmniAuth.config.mock_auth[:rant_tara] = OmniAuth::AuthHash.new(@existing_user_hash)
|
||||
|
||||
visit new_registrant_user_session_path
|
||||
click_link('Sign in')
|
||||
|
||||
assert_text('Signed in successfully')
|
||||
end
|
||||
|
||||
def test_new_user_is_created_and_signed_in
|
||||
OmniAuth.config.mock_auth[:tara] = OmniAuth::AuthHash.new(@new_user_hash)
|
||||
|
||||
visit new_registrant_user_session_path
|
||||
click_link('Sign in')
|
||||
|
||||
assert_text('Signed in successfully')
|
||||
assert 'New Registrant User', RegistrantUser.last.username
|
||||
assert 'EE-51007050604', RegistrantUser.last.registrant_ident
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue