Skip to content

Commit

Permalink
Merge 9501ba2 into 3c357c5
Browse files Browse the repository at this point in the history
  • Loading branch information
duduribeiro committed Jun 10, 2020
2 parents 3c357c5 + 9501ba2 commit a80fd44
Show file tree
Hide file tree
Showing 6 changed files with 61 additions and 81 deletions.
30 changes: 15 additions & 15 deletions spec/dnsimple/client/registrar_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -223,27 +223,27 @@
end

it "builds the correct request" do
subject.get_domain_transfer(account_id, domain_name = "example.com", transfer_id = 42)
subject.get_domain_transfer(account_id, domain_name = "example.com", transfer_id = 361)

expect(WebMock).to have_requested(:get, "https://api.dnsimple.test/v2/#{account_id}/registrar/domains/#{domain_name}/transfers/#{transfer_id}")
.with(headers: { "Accept" => "application/json" })
end

it "returns the domain transfer" do
response = subject.get_domain_transfer(account_id, "example.com", 42)
response = subject.get_domain_transfer(account_id, "example.com", 361)
expect(response).to be_a(Dnsimple::Response)

result = response.data
expect(result).to be_a(Dnsimple::Struct::DomainTransfer)
expect(result.id).to eq(42)
expect(result.domain_id).to eq(2)
expect(result.registrant_id).to eq(3)
expect(result.id).to eq(361)
expect(result.domain_id).to eq(182245)
expect(result.registrant_id).to eq(2715)
expect(result.state).to eq("cancelled")
expect(result.auto_renew).to be(false)
expect(result.whois_privacy).to be(false)
expect(result.status_description).to eq("Canceled by customer")
expect(result.created_at).to eq("2020-04-27T18:08:44Z")
expect(result.updated_at).to eq("2020-04-27T18:20:01Z")
expect(result.created_at).to eq("2020-06-05T18:08:00Z")
expect(result.updated_at).to eq("2020-06-05T18:10:01Z")
end
end

Expand All @@ -256,27 +256,27 @@
end

it "builds the correct request" do
subject.cancel_domain_transfer(account_id, domain_name = "example.com", transfer_id = 42)
subject.cancel_domain_transfer(account_id, domain_name = "example.com", transfer_id = 361)

expect(WebMock).to have_requested(:delete, "https://api.dnsimple.test/v2/#{account_id}/registrar/domains/#{domain_name}/transfers/#{transfer_id}")
.with(headers: { "Accept" => "application/json" })
end

it "returns the domain transfer" do
response = subject.cancel_domain_transfer(account_id, "example.com", 42)
response = subject.cancel_domain_transfer(account_id, "example.com", 361)
expect(response).to be_a(Dnsimple::Response)

result = response.data
expect(result).to be_a(Dnsimple::Struct::DomainTransfer)
expect(result.id).to eq(42)
expect(result.domain_id).to eq(6)
expect(result.registrant_id).to eq(1)
expect(result.id).to eq(361)
expect(result.domain_id).to eq(182245)
expect(result.registrant_id).to eq(2715)
expect(result.state).to eq("transferring")
expect(result.auto_renew).to be(true)
expect(result.auto_renew).to be(false)
expect(result.whois_privacy).to be(false)
expect(result.status_description).to eq(nil)
expect(result.created_at).to eq("2020-04-24T19:19:03Z")
expect(result.updated_at).to eq("2020-04-24T19:19:15Z")
expect(result.created_at).to eq("2020-06-05T18:08:00Z")
expect(result.updated_at).to eq("2020-06-05T18:08:04Z")
end
end

Expand Down
49 changes: 19 additions & 30 deletions spec/fixtures.http/cancelDomainTransfer/success.http
Original file line number Diff line number Diff line change
@@ -1,30 +1,19 @@
HTTP/1.1 202 Accepted
Server: nginx
Date: Wed, 29 Apr 2020 19:49:41 GMT
Content-Type: application/json; charset=utf-8
Transfer-Encoding: chunked
Connection: keep-alive
Status: 202 Accepted
X-RateLimit-Limit: 2400
X-RateLimit-Remaining: 2397
X-RateLimit-Reset: 1588193270
ETag: W/"8404bf2739e44e9f69f3a5199466776d"
Cache-Control: no-store, must-revalidate, private, max-age=0
X-Request-Id: 10d75bcf-0066-4d38-98a2-dc18dd5b6f4c
X-Runtime: 1.752154
Strict-Transport-Security: max-age=31536000

{
"data": {
"id": 42,
"domain_id": 6,
"registrant_id": 1,
"state": "transferring",
"auto_renew": true,
"whois_privacy": false,
"premium_price": null,
"status_description": null,
"created_at": "2020-04-24T19:19:03Z",
"updated_at": "2020-04-24T19:19:15Z"
}
}
HTTP/1.1 202 Accepted
Server: nginx
Date: Fri, 05 Jun 2020 18:09:42 GMT
Content-Type: application/json; charset=utf-8
Transfer-Encoding: identity
Connection: keep-alive
X-RateLimit-Limit: 2400
X-RateLimit-Remaining: 2394
X-RateLimit-Reset: 1591384034
Cache-Control: no-cache
X-Request-Id: 3cf6dcfa-0bb5-439e-863a-af2ef08bc830
X-Runtime: 0.912731
X-Frame-Options: DENY
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
X-Download-Options: noopen
X-Permitted-Cross-Domain-Policies: none

{"data":{"id":361,"domain_id":182245,"registrant_id":2715,"state":"transferring","auto_renew":false,"whois_privacy":false,"status_description":null,"created_at":"2020-06-05T18:08:00Z","updated_at":"2020-06-05T18:08:04Z"}}
51 changes: 21 additions & 30 deletions spec/fixtures.http/getDomainTransfer/success.http
Original file line number Diff line number Diff line change
@@ -1,30 +1,21 @@
HTTP/1.1 200 OK
Server: nginx
Date: Mon, 27 Apr 2020 19:40:00 GMT
Content-Type: application/json; charset=utf-8
Transfer-Encoding: chunked
Connection: keep-alive
Status: 200 OK
X-RateLimit-Limit: 2400
X-RateLimit-Remaining: 2398
X-RateLimit-Reset: 1588019949
ETag: W/"8404bf2739e44e9f69f3a5199466776d"
Cache-Control: max-age=0, private, must-revalidate
X-Request-Id: 4818d867-1f72-4619-ab46-d345e6dd25eb
X-Runtime: 0.092854
Strict-Transport-Security: max-age=31536000

{
"data": {
"id": 42,
"domain_id": 2,
"registrant_id": 3,
"state": "cancelled",
"auto_renew": false,
"whois_privacy": false,
"premium_price": null,
"status_description": "Canceled by customer",
"created_at": "2020-04-27T18:08:44Z",
"updated_at": "2020-04-27T18:20:01Z"
}
}
HTTP/1.1 200 OK
Server: nginx
Date: Fri, 05 Jun 2020 18:23:53 GMT
Content-Type: application/json; charset=utf-8
Transfer-Encoding: identity
Connection: keep-alive
X-RateLimit-Limit: 2400
X-RateLimit-Remaining: 2392
X-RateLimit-Reset: 1591384034
ETag: W/"80c5827934c13b1ca87a587d96e7d1e8"
Cache-Control: max-age=0, private, must-revalidate
X-Request-Id: 9f4959ee-06a9-488c-906e-27a570cafbbf
X-Runtime: 0.078429
X-Frame-Options: DENY
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
X-Download-Options: noopen
X-Permitted-Cross-Domain-Policies: none
Strict-Transport-Security: max-age=31536000

{"data":{"id":361,"domain_id":182245,"registrant_id":2715,"state":"cancelled","auto_renew":false,"whois_privacy":false,"status_description":"Canceled by customer","created_at":"2020-06-05T18:08:00Z","updated_at":"2020-06-05T18:10:01Z"}}
4 changes: 2 additions & 2 deletions spec/fixtures.http/registerDomain/success.http
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ HTTP/1.1 201 Created
Server: nginx
Date: Fri, 09 Dec 2016 19:35:38 GMT
Content-Type: application/json; charset=utf-8
Transfer-Encoding: chunked
Transfer-Encoding: identity
Connection: keep-alive
X-RateLimit-Limit: 2400
X-RateLimit-Remaining: 2396
Expand All @@ -18,4 +18,4 @@ X-Permitted-Cross-Domain-Policies: none
X-XSS-Protection: 1; mode=block
Strict-Transport-Security: max-age=31536000

{"data":{"id":1,"domain_id":999,"registrant_id":2,"period":1,"state":"new","auto_renew":false,"whois_privacy":false,"premium_price":null,"created_at":"2016-12-09T19:35:31Z","updated_at":"2016-12-09T19:35:31Z"}}
{"data":{"id":1,"domain_id":999,"registrant_id":2,"period":1,"state":"new","auto_renew":false,"whois_privacy":false,"created_at":"2016-12-09T19:35:31Z","updated_at":"2016-12-09T19:35:31Z"}}
4 changes: 2 additions & 2 deletions spec/fixtures.http/renewDomain/success.http
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ HTTP/1.1 201 Created
Server: nginx
Date: Fri, 09 Dec 2016 19:46:57 GMT
Content-Type: application/json; charset=utf-8
Transfer-Encoding: chunked
Transfer-Encoding: identity
Connection: keep-alive
X-RateLimit-Limit: 2400
X-RateLimit-Remaining: 2394
Expand All @@ -18,4 +18,4 @@ X-Permitted-Cross-Domain-Policies: none
X-XSS-Protection: 1; mode=block
Strict-Transport-Security: max-age=31536000

{"data":{"id":1,"domain_id":999,"period":1,"state":"new","premium_price":null,"created_at":"2016-12-09T19:46:45Z","updated_at":"2016-12-09T19:46:45Z"}}
{"data":{"id":1,"domain_id":999,"period":1,"state":"new","created_at":"2016-12-09T19:46:45Z","updated_at":"2016-12-09T19:46:45Z"}}
4 changes: 2 additions & 2 deletions spec/fixtures.http/transferDomain/success.http
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ HTTP/1.1 201 Created
Server: nginx
Date: Fri, 09 Dec 2016 19:43:43 GMT
Content-Type: application/json; charset=utf-8
Transfer-Encoding: chunked
Transfer-Encoding: identity
Connection: keep-alive
X-RateLimit-Limit: 2400
X-RateLimit-Remaining: 2395
Expand All @@ -18,4 +18,4 @@ X-Permitted-Cross-Domain-Policies: none
X-XSS-Protection: 1; mode=block
Strict-Transport-Security: max-age=31536000

{"data":{"id":1,"domain_id":999,"registrant_id":2,"state":"transferring","auto_renew":false,"whois_privacy":false,"premium_price":null,"created_at":"2016-12-09T19:43:41Z","updated_at":"2016-12-09T19:43:43Z"}}
{"data":{"id":1,"domain_id":999,"registrant_id":2,"state":"transferring","auto_renew":false,"whois_privacy":false,"created_at":"2016-12-09T19:43:41Z","updated_at":"2016-12-09T19:43:43Z"}}

0 comments on commit a80fd44

Please sign in to comment.