mirror of
https://github.com/internetee/registry.git
synced 2025-07-31 06:56:23 +02:00
Modifications for updating business and private contacts
This commit is contained in:
parent
4afd32ebff
commit
eb64b3aca4
10 changed files with 159 additions and 163 deletions
|
@ -29,47 +29,4 @@ class RegistrantUserCreationTest < ActiveSupport::TestCase
|
|||
user = User.find_by(registrant_ident: 'US-1234')
|
||||
assert_equal('John Smith', user.username)
|
||||
end
|
||||
|
||||
def test_updates_related_contacts_name_if_different_from_e_identity
|
||||
registrars = [registrars(:bestnames), registrars(:goodnames)]
|
||||
contacts = [contacts(:john), contacts(:william), contacts(:identical_to_william)]
|
||||
contacts.each do |c|
|
||||
c.update(ident: '39708290276', ident_country_code: 'EE')
|
||||
end
|
||||
|
||||
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)
|
||||
|
||||
contacts.each do |c|
|
||||
c.reload
|
||||
assert_equal user.username, c.name
|
||||
assert user.actions.find_by(operation: :update, contact_id: c.id)
|
||||
end
|
||||
|
||||
bulk_action = BulkAction.find_by(user_id: user.id, operation: :bulk_update)
|
||||
assert_equal 2, bulk_action.subactions.size
|
||||
|
||||
registrars.each do |r|
|
||||
notification = r.notifications.unread.order('created_at DESC').take
|
||||
if r == registrars(:bestnames)
|
||||
assert_equal '2 contacts have been updated by registrant', notification.text
|
||||
assert_equal 'BulkAction', notification.attached_obj_type
|
||||
assert_equal bulk_action.id, notification.attached_obj_id
|
||||
assert_equal bulk_action.id, notification.action_id
|
||||
else
|
||||
assert_equal 'Contact william-002 has been updated by registrant', notification.text
|
||||
refute notification.action_id
|
||||
refute notification.attached_obj_id
|
||||
refute notification.attached_obj_type
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue