Add company controlled contacts to registrant API

Fix tests.
This commit is contained in:
Alex Sherman 2020-07-15 15:11:47 +05:00
parent 735a0e1642
commit c4de5655e1
8 changed files with 45 additions and 35 deletions

View file

@ -150,13 +150,12 @@ class ContactTest < ActiveSupport::TestCase
end
def test_returns_registrant_user_indirect_contacts
@contact.update!(ident_type: Contact::ORG)
assert_equal '1234', @contact.ident
@contact.update!(ident_type: Contact::ORG, ident: '1234321')
assert_equal 'US', @contact.ident_country_code
registrant_user = RegistrantUser.new(registrant_ident: 'US-1234')
registrant_user = RegistrantUser.new(registrant_ident: 'US-1234321')
registrant_user.stub(:companies, [OpenStruct.new(registration_number: '1234')]) do
assert_equal [@contact], Contact.registrant_user_contacts(registrant_user)
registrant_user.stub(:companies, [OpenStruct.new(registration_number: '1234321')]) do
assert_equal registrant_user.contacts, Contact.registrant_user_contacts(registrant_user)
end
end

View file

@ -273,7 +273,7 @@ class DomainTest < ActiveSupport::TestCase
def test_returns_registrant_user_domains_by_registrant
registrant = contacts(:john).becomes(Registrant)
assert_equal registrant, @domain.registrant
registrant_user = RegistrantUser.new
registrant_user = RegistrantUser.new(registrant_ident: 'US-12345')
registrant_user.stub(:contacts, [registrant]) do
assert_includes Domain.registrant_user_domains(registrant_user), @domain
@ -284,7 +284,7 @@ class DomainTest < ActiveSupport::TestCase
contact = contacts(:jane)
assert_not_equal contact.becomes(Registrant), @domain.registrant
assert_includes @domain.contacts, contact
registrant_user = RegistrantUser.new
registrant_user = RegistrantUser.new(registrant_ident: 'US-12345')
registrant_user.stub(:contacts, [contact]) do
assert_includes Domain.registrant_user_domains(registrant_user), @domain