Merge pull request #722 from internetee/registry-693

REST API: Return successful domain transfers
This commit is contained in:
Timo Võhmar 2018-02-28 16:33:45 +02:00 committed by GitHub
commit 7c45a85cea
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 17 additions and 12 deletions

View file

@ -10,7 +10,10 @@ class APIDomainTransfersTest < ActionDispatch::IntegrationTest
post '/repp/v1/domain_transfers', request_params, { 'HTTP_AUTHORIZATION' => http_auth_key }
assert_response 200
assert_equal ({ data: [{
type: 'domain_transfer'
type: 'domain_transfer',
attributes: {
domain_name: 'shop.test'
},
}] }),
JSON.parse(response.body, symbolize_names: true)
end

View file

@ -7,12 +7,14 @@ class RegistrarDomainTransfersTest < ActionDispatch::IntegrationTest
end
def test_batch_transfer_succeeds
body = { data: { domainTransfers: [{ domainName: 'shop.test', transferCode: '65078d5' }] } }
request_body = { data: { domainTransfers: [{ domainName: 'shop.test', transferCode: '65078d5' }] } }
headers = { 'Content-type' => 'application/json' }
request_stub = stub_request(:post, /domain_transfers/).with(body: body,
request_stub = stub_request(:post, /domain_transfers/).with(body: request_body,
headers: headers,
basic_auth: ['test_goodnames', 'testtest'])
.to_return(status: 204)
.to_return(body: { data: [{
type: 'domain_transfer'
}] }.to_json, status: 200)
visit registrar_domains_url
click_link 'Transfer'
@ -23,7 +25,7 @@ class RegistrarDomainTransfersTest < ActionDispatch::IntegrationTest
assert_requested request_stub
assert_current_path registrar_domains_path
assert_text 'Domains have been successfully transferred'
assert_text '1 domains have been successfully transferred'
end
def test_batch_transfer_fails_gracefully