mirror of
https://github.com/internetee/registry.git
synced 2025-06-10 14:44:47 +02:00
Merge branch 'master' into registry-790
# Conflicts: # test/integration/epp/domain/domain_delete_test.rb # test/integration/epp/domain/domain_update_test.rb # test/integration/epp/domain/transfer/request_test.rb # test/system/admin_area/domains_test.rb
This commit is contained in:
commit
1d79f6548d
61 changed files with 731 additions and 84 deletions
37
test/models/contact_test.rb
Normal file
37
test/models/contact_test.rb
Normal file
|
@ -0,0 +1,37 @@
|
|||
require 'test_helper'
|
||||
|
||||
class ContactTest < ActiveSupport::TestCase
|
||||
setup do
|
||||
@contact = contacts(:john)
|
||||
end
|
||||
|
||||
def test_valid_fixture
|
||||
assert @contact.valid?
|
||||
end
|
||||
|
||||
def test_invalid_without_email
|
||||
@contact.email = ''
|
||||
assert @contact.invalid?
|
||||
end
|
||||
|
||||
def test_email_format_validation
|
||||
@contact.email = 'invalid'
|
||||
assert @contact.invalid?
|
||||
|
||||
@contact.email = 'test@bestmail.test'
|
||||
assert @contact.valid?
|
||||
end
|
||||
|
||||
def test_invalid_without_phone
|
||||
@contact.email = ''
|
||||
assert @contact.invalid?
|
||||
end
|
||||
|
||||
def test_phone_format_validation
|
||||
@contact.phone = '+123.'
|
||||
assert @contact.invalid?
|
||||
|
||||
@contact.phone = '+123.4'
|
||||
assert @contact.valid?
|
||||
end
|
||||
end
|
62
test/models/registrant_user_test.rb
Normal file
62
test/models/registrant_user_test.rb
Normal file
|
@ -0,0 +1,62 @@
|
|||
class RegistrantUserTest < ActiveSupport::TestCase
|
||||
def setup
|
||||
super
|
||||
end
|
||||
|
||||
def teardown
|
||||
super
|
||||
end
|
||||
|
||||
def test_find_or_create_by_api_data_creates_a_user
|
||||
user_data = {
|
||||
ident: '37710100070',
|
||||
first_name: 'JOHN',
|
||||
last_name: 'SMITH'
|
||||
}
|
||||
|
||||
RegistrantUser.find_or_create_by_api_data(user_data)
|
||||
|
||||
user = User.find_by(registrant_ident: 'EE-37710100070')
|
||||
assert_equal('JOHN SMITH', user.username)
|
||||
end
|
||||
|
||||
def test_find_or_create_by_api_data_creates_a_user_after_upcasing_input
|
||||
user_data = {
|
||||
ident: '37710100070',
|
||||
first_name: 'John',
|
||||
last_name: 'Smith'
|
||||
}
|
||||
|
||||
RegistrantUser.find_or_create_by_api_data(user_data)
|
||||
|
||||
user = User.find_by(registrant_ident: 'EE-37710100070')
|
||||
assert_equal('JOHN SMITH', user.username)
|
||||
end
|
||||
|
||||
def test_find_or_create_by_mid_data_creates_a_user
|
||||
user_data = OpenStruct.new(user_country: 'EE', user_id_code: '37710100070',
|
||||
user_givenname: 'JOHN', user_surname: 'SMITH')
|
||||
|
||||
RegistrantUser.find_or_create_by_mid_data(user_data)
|
||||
user = User.find_by(registrant_ident: 'EE-37710100070')
|
||||
assert_equal('JOHN SMITH', user.username)
|
||||
end
|
||||
|
||||
def test_find_or_create_by_idc_with_legacy_header_creates_a_user
|
||||
header = '/C=EE/O=ESTEID/OU=authentication/CN=SMITH,JOHN,37710100070/SN=SMITH/GN=JOHN/serialNumber=37710100070'
|
||||
|
||||
RegistrantUser.find_or_create_by_idc_data(header, RegistrantUser::ACCEPTED_ISSUER)
|
||||
|
||||
user = User.find_by(registrant_ident: 'EE-37710100070')
|
||||
assert_equal('JOHN SMITH', user.username)
|
||||
end
|
||||
|
||||
def test_find_or_create_by_idc_with_rfc2253_header_creates_a_user
|
||||
header = 'serialNumber=37710100070,GN=JOHN,SN=SMITH,CN=SMITH\\,JOHN\\,37710100070,OU=authentication,O=ESTEID,C=EE'
|
||||
|
||||
RegistrantUser.find_or_create_by_idc_data(header, RegistrantUser::ACCEPTED_ISSUER)
|
||||
|
||||
user = User.find_by(registrant_ident: 'EE-37710100070')
|
||||
assert_equal('JOHN SMITH', user.username)
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue