mirror of
https://github.com/internetee/registry.git
synced 2025-07-22 18:56:05 +02:00
Add system test & fix locale
This commit is contained in:
parent
e5c41cf531
commit
9611df92b0
3 changed files with 60 additions and 1 deletions
|
@ -5,7 +5,6 @@ class Registrar
|
|||
|
||||
def update
|
||||
authorize! :manage, :repp
|
||||
|
||||
uri = BASE_URL
|
||||
request = form_request(uri)
|
||||
response = do_request(request, uri)
|
||||
|
|
11
config/locales/registrar/admin_contacts.yml
Normal file
11
config/locales/registrar/admin_contacts.yml
Normal file
|
@ -0,0 +1,11 @@
|
|||
en:
|
||||
registrar:
|
||||
admin_contacts:
|
||||
update:
|
||||
replaced: Admin contacts have been successfully replaced.
|
||||
affected_domains: Affected domains
|
||||
skipped_domains: Skipped domains
|
||||
process_request:
|
||||
affected_domains: Affected domains
|
||||
skipped_domains: Skipped domains
|
||||
replaced: Admin contacts have been successfully replaced.
|
49
test/system/registrar_area/bulk_change/admin_contact_test.rb
Normal file
49
test/system/registrar_area/bulk_change/admin_contact_test.rb
Normal file
|
@ -0,0 +1,49 @@
|
|||
require 'application_system_test_case'
|
||||
|
||||
class RegistrarAreaAdminContactBulkChangeTest < ApplicationSystemTestCase
|
||||
setup do
|
||||
sign_in users(:api_bestnames)
|
||||
end
|
||||
|
||||
def test_replace_domain_contacts_of_current_registrar
|
||||
request_stub = stub_request(:patch, /domains\/admin_contacts/)
|
||||
.with(body: { current_contact_id: 'william-001', new_contact_id: 'john-001' },
|
||||
basic_auth: ['test_bestnames', 'testtest'])
|
||||
.to_return(body: { data: { affected_domains: %w[foo.test bar.test],
|
||||
skipped_domains: %w[baz.test qux.test] } }.to_json,
|
||||
status: 200)
|
||||
|
||||
visit registrar_domains_url
|
||||
click_link 'Bulk change'
|
||||
click_link 'Admin contact'
|
||||
|
||||
find('.current_admin_contact').fill_in 'Current contact ID', with: 'william-001'
|
||||
find('.new_admin_contact').fill_in 'New contact ID', with: 'john-001'
|
||||
click_on 'Replace admin contacts'
|
||||
|
||||
assert_requested request_stub
|
||||
assert_current_path registrar_domains_path
|
||||
assert_text 'Admin contacts have been successfully replaced'
|
||||
assert_text 'Affected domains: foo.test, bar.test'
|
||||
assert_text 'Skipped domains: baz.test, qux.test'
|
||||
end
|
||||
|
||||
def test_fails_gracefully
|
||||
stub_request(:patch, /domains\/admin_contacts/)
|
||||
.to_return(status: 400,
|
||||
body: { message: 'epic fail' }.to_json,
|
||||
headers: { 'Content-type' => Mime[:json] })
|
||||
|
||||
visit registrar_domains_url
|
||||
click_link 'Bulk change'
|
||||
click_link 'Admin contact'
|
||||
|
||||
find('.current_admin_contact').fill_in 'Current contact ID', with: 'william-001'
|
||||
find('.new_admin_contact').fill_in 'New contact ID', with: 'john-001'
|
||||
click_on 'Replace admin contacts'
|
||||
|
||||
assert_text 'epic fail'
|
||||
assert_field 'Current contact ID', with: 'william-001'
|
||||
assert_field 'New contact ID', with: 'john-001'
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue