mirror of
https://github.com/internetee/registry.git
synced 2025-06-09 22:24:47 +02:00
added condition to return if there no any domain_name header
This commit is contained in:
parent
6f08360d41
commit
459f626808
2 changed files with 28 additions and 1 deletions
|
@ -7,6 +7,7 @@ class Registrar
|
|||
ipv6 = params[:ipv6].split("\r\n")
|
||||
|
||||
domains = domain_list_from_csv
|
||||
|
||||
return csv_list_empty_guard if domains == []
|
||||
|
||||
uri = URI.parse("#{ENV['repp_url']}registrar/nameservers")
|
||||
|
@ -53,7 +54,11 @@ class Registrar
|
|||
return if params[:puny_file].blank?
|
||||
|
||||
domains = []
|
||||
CSV.read(params[:puny_file].path, headers: true).map { |b| domains << b['domain_name'] }
|
||||
csv = CSV.read(params[:puny_file].path, headers: true)
|
||||
|
||||
return if csv['domain_name'].blank?
|
||||
csv.map { |b| domains << b['domain_name'] }
|
||||
|
||||
domains.compact
|
||||
rescue CSV::MalformedCSVError
|
||||
[]
|
||||
|
|
|
@ -96,6 +96,26 @@ class RegistrarAreaNameserverBulkChangeTest < ApplicationSystemTestCase
|
|||
end
|
||||
|
||||
def test_replaces_nameservers_with_invalid_domains_list
|
||||
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: "{\"data\":{\"type\":\"nameserver\",\"id\":\"ns1.bestnames.test\",\"domains\":[],\"attributes\":{\"hostname\":\"new-ns.bestnames.test\",\"ipv4\":[\"192.0.2.55\",\"192.0.2.56\"],\"ipv6\":[\"2001:db8::55\",\"2001:db8::56\"]}}}",
|
||||
headers: {
|
||||
'Accept'=>'*/*',
|
||||
'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3',
|
||||
'Authorization'=>'Basic dGVzdF9nb29kbmFtZXM6dGVzdHRlc3Q=',
|
||||
'Content-Type'=>'application/json',
|
||||
'Host'=>'epp:3000',
|
||||
'User-Agent'=>'Ruby'
|
||||
}).
|
||||
to_return(status: 200, body: "", headers: {})
|
||||
|
||||
visit registrar_domains_url
|
||||
click_link 'Bulk change'
|
||||
click_link 'Nameserver'
|
||||
|
@ -110,6 +130,8 @@ class RegistrarAreaNameserverBulkChangeTest < ApplicationSystemTestCase
|
|||
click_on 'Replace nameserver'
|
||||
end
|
||||
|
||||
assert_requested request_stub
|
||||
|
||||
assert_text 'CSV scoped domain list seems empty. Make sure that domains are added and ' \
|
||||
'"domain_name" header is present.'
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue