mirror of
https://github.com/internetee/registry.git
synced 2025-07-23 11:16:00 +02:00
parent
2db401fd98
commit
0cdbd891cc
2 changed files with 7 additions and 7 deletions
|
@ -11,7 +11,7 @@ class Registrar
|
||||||
ipv6 = params[:ipv6].split("\r\n")
|
ipv6 = params[:ipv6].split("\r\n")
|
||||||
|
|
||||||
uri = URI.parse("#{ENV['repp_url']}registrar/nameservers")
|
uri = URI.parse("#{ENV['repp_url']}registrar/nameservers")
|
||||||
request = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json')
|
request = Net::HTTP::Put.new(uri, 'Content-Type' => 'application/json')
|
||||||
request.body = { data: { type: 'nameserver', id: params[:old_hostname],
|
request.body = { data: { type: 'nameserver', id: params[:old_hostname],
|
||||||
attributes: { hostname: params[:new_hostname],
|
attributes: { hostname: params[:new_hostname],
|
||||||
ipv4: ipv4,
|
ipv4: ipv4,
|
||||||
|
|
|
@ -12,7 +12,7 @@ class RegistrarNameserverReplacementTest < ActionDispatch::IntegrationTest
|
||||||
attributes: { hostname: 'new-ns.bestnames.test',
|
attributes: { hostname: 'new-ns.bestnames.test',
|
||||||
ipv4: %w[192.0.2.55 192.0.2.56],
|
ipv4: %w[192.0.2.55 192.0.2.56],
|
||||||
ipv6: %w[2001:db8::55 2001:db8::56] } } }
|
ipv6: %w[2001:db8::55 2001:db8::56] } } }
|
||||||
request_stub = stub_request(:post, /registrar\/nameservers/).with(body: request_body,
|
request_stub = stub_request(:put, /registrar\/nameservers/).with(body: request_body,
|
||||||
headers: { 'Content-type' => 'application/json' },
|
headers: { 'Content-type' => 'application/json' },
|
||||||
basic_auth: ['test_goodnames', 'testtest'])
|
basic_auth: ['test_goodnames', 'testtest'])
|
||||||
.to_return(body: { data: [{
|
.to_return(body: { data: [{
|
||||||
|
@ -35,7 +35,7 @@ class RegistrarNameserverReplacementTest < ActionDispatch::IntegrationTest
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_fails_gracefully
|
def test_fails_gracefully
|
||||||
stub_request(:post, /registrar\/nameservers/).to_return(status: 400,
|
stub_request(:put, /registrar\/nameservers/).to_return(status: 400,
|
||||||
body: { errors: [{ title: 'epic fail' }] }.to_json,
|
body: { errors: [{ title: 'epic fail' }] }.to_json,
|
||||||
headers: { 'Content-type' => 'application/json' })
|
headers: { 'Content-type' => 'application/json' })
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue