mirror of
https://github.com/internetee/registry.git
synced 2025-08-03 16:32:04 +02:00
Merge pull request #1726 from internetee/1724-update-contact-object-name-using-data-from-e-edentity
Registrant API: Update Contact object name using data from e-identity
This commit is contained in:
commit
ca1c4ecbd2
2 changed files with 34 additions and 3 deletions
|
@ -14,7 +14,7 @@ class RegistrantUserCreationTest < ActiveSupport::TestCase
|
|||
assert_equal('JOHN SMITH', user.username)
|
||||
end
|
||||
|
||||
def test_find_or_create_by_api_data_creates_a_user_after_upcasing_input
|
||||
def test_find_or_create_by_api_data_creates_a_user_with_original_name
|
||||
user_data = {
|
||||
ident: '37710100070',
|
||||
first_name: 'John',
|
||||
|
@ -24,6 +24,25 @@ class RegistrantUserCreationTest < ActiveSupport::TestCase
|
|||
RegistrantUser.find_or_create_by_api_data(user_data)
|
||||
|
||||
user = User.find_by(registrant_ident: 'EE-37710100070')
|
||||
assert_equal('JOHN SMITH', user.username)
|
||||
assert_equal('John Smith', user.username)
|
||||
end
|
||||
|
||||
def test_updates_related_contacts_name_if_differs_from_e_identity
|
||||
contact = contacts(:john)
|
||||
contact.update(ident: '39708290276', ident_country_code: 'EE')
|
||||
|
||||
user_data = {
|
||||
ident: '39708290276',
|
||||
first_name: 'John',
|
||||
last_name: 'Doe'
|
||||
}
|
||||
|
||||
RegistrantUser.find_or_create_by_api_data(user_data)
|
||||
|
||||
user = User.find_by(registrant_ident: 'EE-39708290276')
|
||||
assert_equal('John Doe', user.username)
|
||||
|
||||
contact.reload
|
||||
assert_equal user.username, contact.name
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue