Merge branch 'master' of https://github.com/internetee/registry into 1804-upgrade-ui-tests-for-admin-portal-users

This commit is contained in:
Oleg Hasjanov 2021-01-15 16:20:56 +02:00
commit 54a8c65c27
28 changed files with 380 additions and 50 deletions

View file

@ -0,0 +1,2 @@
domain_name,delete_reason
sh\á;[]c'
1 domain_name,delete_reason
2 sh\á;[]c'

View file

@ -0,0 +1,5 @@
domain_name,delete_reason
shop.test,ENTITY_BURIED
airport.test,INVALID_PHONE
library.test,INVALID_EMAIL
nonexistant.test,ENTITY_BURIED
1 domain_name delete_reason
2 shop.test ENTITY_BURIED
3 airport.test INVALID_PHONE
4 library.test INVALID_EMAIL
5 nonexistant.test ENTITY_BURIED

View file

@ -0,0 +1,2 @@
domain_name
shop.test
1 domain_name
2 shop.test

View file

@ -67,7 +67,8 @@ class APINameserversPutTest < ApplicationIntegrationTest
attributes: { hostname: 'ns55.bestnames.test',
ipv4: ['192.0.2.55'],
ipv6: ['2001:db8::55'] },
affected_domains: ["airport.test", "shop.test"] }}),
affected_domains: ["airport.test", "shop.test"],
skipped_domains: [] }}),
JSON.parse(response.body, symbolize_names: true)
end

View file

@ -37,4 +37,17 @@ class ReppV1DomainsTransferInfoTest < ActionDispatch::IntegrationTest
assert_equal 'Authorization error', json[:message]
assert_empty json[:data]
end
def test_processes_puny_domains
@domain.update(name_puny: 'xn--prototp-s2aa.ee')
headers = @auth_headers
headers['Auth-Code'] = @domain.transfer_code
get "/repp/v1/domains/xn--prototp-s2aa.ee/transfer_info", headers: headers
json = JSON.parse(response.body, symbolize_names: true)
assert_response :ok
assert_equal 1000, json[:code]
end
end

View file

@ -10,7 +10,7 @@ class ReplaceNameserversTest < ActiveSupport::TestCase
ipv6: '2001:db8::2' }
result = @registrar.replace_nameservers('ns1.bestnames.test', new_attributes)
assert_equal(["airport.test", "shop.test"], result)
assert_equal([["airport.test", "shop.test"], []], result)
end
def test_replace_nameservers_in_bulk_returns_empty_array_for_non_existent_base_nameserver
@ -18,6 +18,22 @@ class ReplaceNameserversTest < ActiveSupport::TestCase
ipv6: '2001:db8::2' }
result = @registrar.replace_nameservers('ns3.bestnames.test', new_attributes)
assert_equal([], result)
assert_equal([[], []], result)
end
def test_replace_nameserver_in_bulk_respects_domain_limit_scope
eligible_domain = domains(:shop)
unscoped_domain = domains(:airport)
new_attributes = { hostname: 'ns-updated1.bestnames.test', ipv4: '192.0.3.1',
ipv6: '2001:db8::2' }
result = @registrar.replace_nameservers('ns1.bestnames.test', new_attributes, domains: ['shop.test'])
assert_equal([["shop.test"], []], result)
unscoped_domain.reload
eligible_domain.reload
assert eligible_domain.nameservers.where(hostname: 'ns1.bestnames.test').empty?
assert unscoped_domain.nameservers.where(hostname: 'ns1.bestnames.test').any?
end
end

View file

@ -0,0 +1,24 @@
require 'application_system_test_case'
require 'test_helper'
class AdminAreaMassActionsForceDeleteTest < ApplicationSystemTestCase
def setup
sign_in users(:admin)
end
def test_processes_uploaded_valid_csv
visit admin_mass_actions_path
attach_file('entry_list', Rails.root.join('test', 'fixtures', 'files', 'mass_actions', 'valid_mass_force_delete_list.csv').to_s)
click_link_or_button 'Start force delete process'
assert_text 'force_delete completed for ["shop.test", "airport.test", "library.test"]. Failed: ["nonexistant.test"]'
end
def test_processes_uploaded_invalid_csv
visit admin_mass_actions_path
attach_file(:entry_list, Rails.root.join('test', 'fixtures', 'files', 'mass_actions', 'invalid_mass_force_delete_list.csv').to_s)
click_link_or_button 'Start force delete process'
assert_text 'Dataset integrity validation failed for force_delete'
end
end

View file

@ -18,7 +18,8 @@ class RegistrarAreaNameserverBulkChangeTest < ApplicationSystemTestCase
.to_return(body: { data: {
type: 'nameserver',
id: 'new-ns.bestnames.test',
affected_domains: ["airport.test", "shop.test"]
affected_domains: ["airport.test", "shop.test"],
skipped_domains: []
}
}.to_json, status: 200)
@ -59,4 +60,38 @@ class RegistrarAreaNameserverBulkChangeTest < ApplicationSystemTestCase
assert_field 'ipv4', with: 'ipv4'
assert_field 'ipv6', with: 'ipv6'
end
def test_replaces_nameservers_only_for_scoped_domains
request_body = { data: { type: 'nameserver',
id: 'ns1.bestnames.test',
domains: ['shop.test'],
attributes: { hostname: 'new-ns.bestnames.test',
ipv4: %w[192.0.2.55 192.0.2.56],
ipv6: %w[2001:db8::55 2001:db8::56] } } }
request_stub = stub_request(:put, /registrar\/nameservers/).with(body: request_body,
headers: { 'Content-type' => Mime[:json] },
basic_auth: ['test_goodnames', 'testtest'])
.to_return(body: { data: {
type: 'nameserver',
id: 'new-ns.bestnames.test',
affected_domains: ["shop.test"],
skipped_domains: []}}.to_json, status: 200)
visit registrar_domains_url
click_link 'Bulk change'
click_link 'Nameserver'
fill_in 'Old hostname', with: 'ns1.bestnames.test'
fill_in 'New hostname', with: 'new-ns.bestnames.test'
fill_in 'ipv4', with: "192.0.2.55\n192.0.2.56"
fill_in 'ipv6', with: "2001:db8::55\n2001:db8::56"
attach_file :puny_file, Rails.root.join('test', 'fixtures', 'files', 'valid_domains_for_ns_replacement.csv').to_s
click_on 'Replace nameserver'
assert_requested request_stub
assert_current_path registrar_domains_path
assert_text 'Nameserver have been successfully replaced'
assert_text 'Affected domains: shop.test'
end
end