mirror of
https://github.com/internetee/registry.git
synced 2025-07-23 11:16:00 +02:00
Merge remote-tracking branch 'origin/master' into log-bounced-emails
This commit is contained in:
commit
fc34105c40
70 changed files with 791 additions and 4967 deletions
|
@ -28,6 +28,20 @@ class RegistrantAreaDomainListTest < ApplicationSystemTestCase
|
|||
assert_no_text 'metro.test'
|
||||
end
|
||||
|
||||
def test_only_shows_direct_relation_and_or_company_domains
|
||||
# case https://github.com/internetee/registry/issues/1690
|
||||
tech_contact = contacts(:registrar_ltd)
|
||||
|
||||
# All domains share the same tech contact object
|
||||
Domain.all.each do |domain|
|
||||
DomainContact.create(domain: domain, contact: tech_contact, type: TechDomainContact)
|
||||
end
|
||||
|
||||
visit registrant_domains_url
|
||||
assert_no_text 'Company register is unavailable.'
|
||||
assert_no_text 'metro.test'
|
||||
end
|
||||
|
||||
def test_notification_when_company_register_is_unavailable
|
||||
CompanyRegister::Client.stub(:new, CompanyRegisterClientStub.new) do
|
||||
visit registrant_domains_url
|
||||
|
@ -54,4 +68,4 @@ class RegistrantAreaDomainListTest < ApplicationSystemTestCase
|
|||
|
||||
assert_text 'shop.test'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
51
test/system/registrant_area/tara/tara_users_test.rb
Normal file
51
test/system/registrant_area/tara/tara_users_test.rb
Normal file
|
@ -0,0 +1,51 @@
|
|||
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[:rant_tara] = OmniAuth::AuthHash.new(@new_user_hash)
|
||||
|
||||
assert_difference 'RegistrantUser.count' do
|
||||
visit new_registrant_user_session_path
|
||||
click_link('Sign in')
|
||||
|
||||
assert_equal 'New Registrant User', RegistrantUser.last.username
|
||||
assert_equal 'EE-51007050604', RegistrantUser.last.registrant_ident
|
||||
assert_text('Signed in successfully')
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,35 +0,0 @@
|
|||
require 'application_system_test_case'
|
||||
|
||||
class RegistrarAreaMobileIDSignInTest < JavaScriptApplicationSystemTestCase
|
||||
def setup
|
||||
super
|
||||
WebMock.allow_net_connect!
|
||||
|
||||
@user = users(:api_bestnames)
|
||||
@user.identity_code = '1234'
|
||||
@user.save
|
||||
end
|
||||
|
||||
def test_valid_phone_number
|
||||
mock_client = Minitest::Mock.new
|
||||
mock_client.expect(:authenticate,
|
||||
OpenStruct.new(user_id_code: '1234', challenge_id: '1234'),
|
||||
[{ phone: "+3721234",
|
||||
message_to_display: "Authenticating",
|
||||
service_name: "Testimine" }])
|
||||
mock_client.expect(:session_code, 1234)
|
||||
|
||||
Digidoc::Client.stub(:new, mock_client) do
|
||||
visit new_registrar_user_session_path
|
||||
|
||||
click_on 'login-with-mobile-id-btn'
|
||||
|
||||
fill_in 'user[phone]', with: '1234'
|
||||
click_button 'Login'
|
||||
|
||||
flash_message = page.find('div.bg-success')
|
||||
assert_equal('Confirmation sms was sent to your phone. Verification code is 1234.',
|
||||
flash_message.text)
|
||||
end
|
||||
end
|
||||
end
|
45
test/system/registrar_area/tara/tara_users_test.rb
Normal file
45
test/system/registrar_area/tara/tara_users_test.rb
Normal file
|
@ -0,0 +1,45 @@
|
|||
require 'application_system_test_case'
|
||||
|
||||
class TaraUsersTest < ApplicationSystemTestCase
|
||||
def setup
|
||||
super
|
||||
|
||||
OmniAuth.config.test_mode = true
|
||||
@user = users(:api_bestnames)
|
||||
|
||||
@existing_user_hash = {
|
||||
'provider' => 'tara',
|
||||
'uid' => "EE" + @user.identity_code
|
||||
}
|
||||
|
||||
@new_user_hash = {
|
||||
'provider' => 'tara',
|
||||
'uid' => 'EE51007050604'
|
||||
}
|
||||
end
|
||||
|
||||
def teardown
|
||||
super
|
||||
|
||||
OmniAuth.config.test_mode = false
|
||||
OmniAuth.config.mock_auth['tara'] = nil
|
||||
end
|
||||
|
||||
def test_existing_user_gets_signed_in
|
||||
OmniAuth.config.mock_auth[:tara] = OmniAuth::AuthHash.new(@existing_user_hash)
|
||||
|
||||
visit new_registrar_user_session_path
|
||||
click_link('Sign in')
|
||||
|
||||
assert_text('Signed in successfully')
|
||||
end
|
||||
|
||||
def test_nonexisting_user_gets_error_message
|
||||
OmniAuth.config.mock_auth[:tara] = OmniAuth::AuthHash.new(@new_user_hash)
|
||||
|
||||
visit new_registrar_user_session_path
|
||||
click_link('Sign in')
|
||||
|
||||
assert_text('No such user')
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue