mirror of
https://github.com/internetee/registry.git
synced 2025-07-28 05:26:17 +02:00
Merge pull request #2730 from internetee/2702-optional-admin-contact-for-private-registrations
Make admin contacts optional for private registrants
This commit is contained in:
commit
a9b341ebfe
5 changed files with 173 additions and 8 deletions
|
@ -108,9 +108,32 @@ class ReppV1DomainsContactsTest < ActionDispatch::IntegrationTest
|
|||
refute @domain.tech_contacts.find_by(code: contact.code).present?
|
||||
end
|
||||
|
||||
def test_can_remove_all_admin_contacts_for_private_registrant
|
||||
Spy.on_instance_method(Actions::DomainUpdate, :validate_email).and_return(true)
|
||||
|
||||
@domain.registrant.update!(ident_type: 'priv')
|
||||
@domain.reload
|
||||
assert_not @domain.registrant.org?
|
||||
|
||||
contact = @domain.admin_contacts.last
|
||||
|
||||
payload = { contacts: [ { code: contact.code, type: 'admin' } ] }
|
||||
delete "/repp/v1/domains/#{@domain.name}/contacts", headers: @auth_headers, params: payload
|
||||
json = JSON.parse(response.body, symbolize_names: true)
|
||||
|
||||
@domain.reload
|
||||
assert_response :ok
|
||||
assert_equal 1000, json[:code]
|
||||
|
||||
assert_empty @domain.admin_contacts
|
||||
end
|
||||
|
||||
def test_can_not_remove_one_and_only_contact
|
||||
Spy.on_instance_method(Actions::DomainUpdate, :validate_email).and_return(true)
|
||||
|
||||
@domain.registrant.update!(ident_type: 'org')
|
||||
@domain.reload
|
||||
|
||||
contact = @domain.admin_contacts.last
|
||||
|
||||
payload = { contacts: [ { code: contact.code, type: 'admin' } ] }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue