-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for domain transfer lock APIs (#183)
- Loading branch information
Wilson Lin
authored
Sep 1, 2023
1 parent
f1038df
commit ad43998
Showing
7 changed files
with
216 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
HTTP/1.1 200 OK | ||
Server: nginx | ||
Date: Tue, 15 Aug 2023 09:58:37 GMT | ||
Content-Type: application/json; charset=utf-8 | ||
Connection: keep-alive | ||
X-RateLimit-Limit: 2400 | ||
X-RateLimit-Remaining: 2398 | ||
X-RateLimit-Reset: 1488538623 | ||
ETag: W/"fc2368a31a1b6a3afcca33bb37ff6b9d" | ||
Cache-Control: max-age=0, private, must-revalidate | ||
X-Request-Id: 8b0fe49a-c810-4552-84ab-a1cd9b4a7786 | ||
X-Runtime: 0.024780 | ||
X-Content-Type-Options: nosniff | ||
X-Download-Options: noopen | ||
X-Frame-Options: DENY | ||
X-Permitted-Cross-Domain-Policies: none | ||
X-XSS-Protection: 1; mode=block | ||
Strict-Transport-Security: max-age=31536000 | ||
|
||
{"data":{"enabled":false}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
HTTP/1.1 201 Created | ||
Server: nginx | ||
Date: Tue, 15 Aug 2023 09:58:37 GMT | ||
Content-Type: application/json; charset=utf-8 | ||
Connection: keep-alive | ||
X-RateLimit-Limit: 2400 | ||
X-RateLimit-Remaining: 2398 | ||
X-RateLimit-Reset: 1488538623 | ||
ETag: W/"fc2368a31a1b6a3afcca33bb37ff6b9d" | ||
Cache-Control: max-age=0, private, must-revalidate | ||
X-Request-Id: 8b0fe49a-c810-4552-84ab-a1cd9b4a7786 | ||
X-Runtime: 0.024780 | ||
X-Content-Type-Options: nosniff | ||
X-Download-Options: noopen | ||
X-Frame-Options: DENY | ||
X-Permitted-Cross-Domain-Policies: none | ||
X-XSS-Protection: 1; mode=block | ||
Strict-Transport-Security: max-age=31536000 | ||
|
||
{"data":{"enabled":true}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
HTTP/1.1 200 OK | ||
Server: nginx | ||
Date: Tue, 15 Aug 2023 09:58:37 GMT | ||
Content-Type: application/json; charset=utf-8 | ||
Connection: keep-alive | ||
X-RateLimit-Limit: 2400 | ||
X-RateLimit-Remaining: 2398 | ||
X-RateLimit-Reset: 1488538623 | ||
ETag: W/"fc2368a31a1b6a3afcca33bb37ff6b9d" | ||
Cache-Control: max-age=0, private, must-revalidate | ||
X-Request-Id: 8b0fe49a-c810-4552-84ab-a1cd9b4a7786 | ||
X-Runtime: 0.024780 | ||
X-Content-Type-Options: nosniff | ||
X-Download-Options: noopen | ||
X-Frame-Options: DENY | ||
X-Permitted-Cross-Domain-Policies: none | ||
X-XSS-Protection: 1; mode=block | ||
Strict-Transport-Security: max-age=31536000 | ||
|
||
{"data":{"enabled":true}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
import { expect } from "chai"; | ||
import * as nock from "nock"; | ||
import { createTestClient, loadFixture } from "./util"; | ||
|
||
const dnsimple = createTestClient(); | ||
|
||
describe("domain transfer lock", () => { | ||
const accountId = 1010; | ||
|
||
describe("#getDomainTransferLock", () => { | ||
const fixture = loadFixture("getDomainTransferLock/success.http"); | ||
|
||
it("produces a transfer lock", (done) => { | ||
nock("https://api.dnsimple.com") | ||
.get("/v2/1010/registrar/domains/101/transfer_lock") | ||
.reply(fixture.statusCode, fixture.body); | ||
|
||
dnsimple.registrar.getDomainTransferLock(accountId, "101").then( | ||
({ data }) => { | ||
expect(data).to.deep.eq({ | ||
enabled: true, | ||
}); | ||
done(); | ||
}, | ||
(error) => { | ||
done(error); | ||
} | ||
); | ||
}); | ||
}); | ||
|
||
describe("#enableDomainTransferLock", () => { | ||
const fixture = loadFixture("enableDomainTransferLock/success.http"); | ||
|
||
it("produces a transfer lock", (done) => { | ||
nock("https://api.dnsimple.com") | ||
.post("/v2/1010/registrar/domains/101/transfer_lock") | ||
.reply(fixture.statusCode, fixture.body); | ||
|
||
dnsimple.registrar.enableDomainTransferLock(accountId, "101").then( | ||
({ data }) => { | ||
expect(data).to.deep.eq({ | ||
enabled: true, | ||
}); | ||
done(); | ||
}, | ||
(error) => { | ||
done(error); | ||
} | ||
); | ||
}); | ||
}); | ||
|
||
describe("#disableDomainTransferLock", () => { | ||
const fixture = loadFixture("disableDomainTransferLock/success.http"); | ||
|
||
it("produces a transfer lock", (done) => { | ||
nock("https://api.dnsimple.com") | ||
.delete("/v2/1010/registrar/domains/101/transfer_lock") | ||
.reply(fixture.statusCode, fixture.body); | ||
|
||
dnsimple.registrar.disableDomainTransferLock(accountId, "101").then( | ||
({ data }) => { | ||
expect(data).to.deep.eq({ | ||
enabled: false, | ||
}); | ||
done(); | ||
}, | ||
(error) => { | ||
done(error); | ||
} | ||
); | ||
}); | ||
}); | ||
}); |