-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into dependabot/go_modules/github.com/go-resty/re…
…sty/v2-2.16.2
- Loading branch information
Showing
7 changed files
with
424 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,267 @@ | ||
--- | ||
version: 1 | ||
interactions: | ||
- request: | ||
body: '{"domain":"linodego-blue-test.com","type":"master","soa_email":"[email protected]","master_ips":null,"axfr_ips":null,"tags":null}' | ||
form: {} | ||
headers: | ||
Accept: | ||
- application/json | ||
Content-Type: | ||
- application/json | ||
User-Agent: | ||
- linodego/dev https://github.com/linode/linodego | ||
url: https://api.linode.com/v4beta/domains | ||
method: POST | ||
response: | ||
body: '{"id": 3163304, "type": "master", "domain": "linodego-blue-test.com", "tags": | ||
[], "group": "", "status": "active", "errors": "", "description": "", "soa_email": | ||
"[email protected]", "retry_sec": 0, "master_ips": [], "axfr_ips": [], "expire_sec": | ||
0, "refresh_sec": 0, "ttl_sec": 0, "created": "2018-01-02T03:04:05", "updated": | ||
"2018-01-02T03:04:05"}' | ||
headers: | ||
Access-Control-Allow-Credentials: | ||
- "true" | ||
Access-Control-Allow-Headers: | ||
- Authorization, Origin, X-Requested-With, Content-Type, Accept, X-Filter | ||
Access-Control-Allow-Methods: | ||
- HEAD, GET, OPTIONS, POST, PUT, DELETE | ||
Access-Control-Allow-Origin: | ||
- '*' | ||
Access-Control-Expose-Headers: | ||
- X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Status | ||
Akamai-Internal-Account: | ||
- '*' | ||
Cache-Control: | ||
- max-age=0, no-cache, no-store | ||
Connection: | ||
- keep-alive | ||
Content-Length: | ||
- "350" | ||
Content-Security-Policy: | ||
- default-src 'none' | ||
Content-Type: | ||
- application/json | ||
Expires: | ||
- Tue, 19 Nov 2024 15:25:43 GMT | ||
Pragma: | ||
- no-cache | ||
Strict-Transport-Security: | ||
- max-age=31536000 | ||
Vary: | ||
- Authorization, X-Filter | ||
X-Accepted-Oauth-Scopes: | ||
- domains:read_write | ||
X-Content-Type-Options: | ||
- nosniff | ||
X-Frame-Options: | ||
- DENY | ||
- DENY | ||
X-Oauth-Scopes: | ||
- account:read_write databases:read_write domains:read_write events:read_write | ||
firewall:read_write images:read_write ips:read_write linodes:read_write lke:read_write | ||
longview:read_write nodebalancers:read_write object_storage:read_write stackscripts:read_write | ||
volumes:read_write vpc:read_write | ||
X-Ratelimit-Limit: | ||
- "1600" | ||
X-Xss-Protection: | ||
- 1; mode=block | ||
status: 200 OK | ||
code: 200 | ||
duration: "" | ||
- request: | ||
body: '{"domain":"linodego-domain-clone.com"}' | ||
form: {} | ||
headers: | ||
Accept: | ||
- application/json | ||
Content-Type: | ||
- application/json | ||
User-Agent: | ||
- linodego/dev https://github.com/linode/linodego | ||
url: https://api.linode.com/v4beta/domains/3163304/clone | ||
method: POST | ||
response: | ||
body: '{"id": 3163305, "type": "master", "domain": "linodego-domain-clone.com", | ||
"tags": [], "group": "", "status": "active", "errors": "", "description": "", | ||
"soa_email": "[email protected]", "retry_sec": 0, "master_ips": [], "axfr_ips": | ||
[], "expire_sec": 0, "refresh_sec": 0, "ttl_sec": 0, "created": "2018-01-02T03:04:05", | ||
"updated": "2018-01-02T03:04:05"}' | ||
headers: | ||
Access-Control-Allow-Credentials: | ||
- "true" | ||
Access-Control-Allow-Headers: | ||
- Authorization, Origin, X-Requested-With, Content-Type, Accept, X-Filter | ||
Access-Control-Allow-Methods: | ||
- HEAD, GET, OPTIONS, POST, PUT, DELETE | ||
Access-Control-Allow-Origin: | ||
- '*' | ||
Access-Control-Expose-Headers: | ||
- X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Status | ||
Akamai-Internal-Account: | ||
- '*' | ||
Cache-Control: | ||
- max-age=0, no-cache, no-store | ||
Connection: | ||
- keep-alive | ||
Content-Length: | ||
- "353" | ||
Content-Security-Policy: | ||
- default-src 'none' | ||
Content-Type: | ||
- application/json | ||
Expires: | ||
- Tue, 19 Nov 2024 15:25:45 GMT | ||
Pragma: | ||
- no-cache | ||
Strict-Transport-Security: | ||
- max-age=31536000 | ||
Vary: | ||
- Authorization, X-Filter | ||
X-Accepted-Oauth-Scopes: | ||
- domains:read_write | ||
X-Content-Type-Options: | ||
- nosniff | ||
X-Frame-Options: | ||
- DENY | ||
- DENY | ||
X-Oauth-Scopes: | ||
- account:read_write databases:read_write domains:read_write events:read_write | ||
firewall:read_write images:read_write ips:read_write linodes:read_write lke:read_write | ||
longview:read_write nodebalancers:read_write object_storage:read_write stackscripts:read_write | ||
volumes:read_write vpc:read_write | ||
X-Ratelimit-Limit: | ||
- "1600" | ||
X-Xss-Protection: | ||
- 1; mode=block | ||
status: 200 OK | ||
code: 200 | ||
duration: "" | ||
- request: | ||
body: "" | ||
form: {} | ||
headers: | ||
Accept: | ||
- application/json | ||
Content-Type: | ||
- application/json | ||
User-Agent: | ||
- linodego/dev https://github.com/linode/linodego | ||
url: https://api.linode.com/v4beta/domains/3163305 | ||
method: DELETE | ||
response: | ||
body: '{}' | ||
headers: | ||
Access-Control-Allow-Credentials: | ||
- "true" | ||
Access-Control-Allow-Headers: | ||
- Authorization, Origin, X-Requested-With, Content-Type, Accept, X-Filter | ||
Access-Control-Allow-Methods: | ||
- HEAD, GET, OPTIONS, POST, PUT, DELETE | ||
Access-Control-Allow-Origin: | ||
- '*' | ||
Access-Control-Expose-Headers: | ||
- X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Status | ||
Akamai-Internal-Account: | ||
- '*' | ||
Cache-Control: | ||
- max-age=0, no-cache, no-store | ||
Connection: | ||
- keep-alive | ||
Content-Length: | ||
- "2" | ||
Content-Security-Policy: | ||
- default-src 'none' | ||
Content-Type: | ||
- application/json | ||
Expires: | ||
- Tue, 19 Nov 2024 15:25:45 GMT | ||
Pragma: | ||
- no-cache | ||
Strict-Transport-Security: | ||
- max-age=31536000 | ||
Vary: | ||
- Authorization, X-Filter | ||
X-Accepted-Oauth-Scopes: | ||
- domains:read_write | ||
X-Content-Type-Options: | ||
- nosniff | ||
X-Frame-Options: | ||
- DENY | ||
- DENY | ||
X-Oauth-Scopes: | ||
- account:read_write databases:read_write domains:read_write events:read_write | ||
firewall:read_write images:read_write ips:read_write linodes:read_write lke:read_write | ||
longview:read_write nodebalancers:read_write object_storage:read_write stackscripts:read_write | ||
volumes:read_write vpc:read_write | ||
X-Ratelimit-Limit: | ||
- "1600" | ||
X-Xss-Protection: | ||
- 1; mode=block | ||
status: 200 OK | ||
code: 200 | ||
duration: "" | ||
- request: | ||
body: "" | ||
form: {} | ||
headers: | ||
Accept: | ||
- application/json | ||
Content-Type: | ||
- application/json | ||
User-Agent: | ||
- linodego/dev https://github.com/linode/linodego | ||
url: https://api.linode.com/v4beta/domains/3163304 | ||
method: DELETE | ||
response: | ||
body: '{}' | ||
headers: | ||
Access-Control-Allow-Credentials: | ||
- "true" | ||
Access-Control-Allow-Headers: | ||
- Authorization, Origin, X-Requested-With, Content-Type, Accept, X-Filter | ||
Access-Control-Allow-Methods: | ||
- HEAD, GET, OPTIONS, POST, PUT, DELETE | ||
Access-Control-Allow-Origin: | ||
- '*' | ||
Access-Control-Expose-Headers: | ||
- X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Status | ||
Akamai-Internal-Account: | ||
- '*' | ||
Cache-Control: | ||
- max-age=0, no-cache, no-store | ||
Connection: | ||
- keep-alive | ||
Content-Length: | ||
- "2" | ||
Content-Security-Policy: | ||
- default-src 'none' | ||
Content-Type: | ||
- application/json | ||
Expires: | ||
- Tue, 19 Nov 2024 15:25:45 GMT | ||
Pragma: | ||
- no-cache | ||
Strict-Transport-Security: | ||
- max-age=31536000 | ||
Vary: | ||
- Authorization, X-Filter | ||
X-Accepted-Oauth-Scopes: | ||
- domains:read_write | ||
X-Content-Type-Options: | ||
- nosniff | ||
X-Frame-Options: | ||
- DENY | ||
- DENY | ||
X-Oauth-Scopes: | ||
- account:read_write databases:read_write domains:read_write events:read_write | ||
firewall:read_write images:read_write ips:read_write linodes:read_write lke:read_write | ||
longview:read_write nodebalancers:read_write object_storage:read_write stackscripts:read_write | ||
volumes:read_write vpc:read_write | ||
X-Ratelimit-Limit: | ||
- "1600" | ||
X-Xss-Protection: | ||
- 1; mode=block | ||
status: 200 OK | ||
code: 200 | ||
duration: "" |
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,54 @@ | ||
package unit | ||
|
||
import ( | ||
"context" | ||
"github.com/linode/linodego" | ||
"github.com/stretchr/testify/assert" | ||
"testing" | ||
) | ||
|
||
func TestDomain_Clone(t *testing.T) { | ||
fixtureData, err := fixtures.GetFixture("domain_clone") | ||
assert.NoError(t, err) | ||
|
||
var base ClientBaseCase | ||
base.SetUp(t) | ||
defer base.TearDown(t) | ||
|
||
requestData := linodego.DomainCloneOptions{ | ||
Domain: "linodego-domain-clone.com", | ||
} | ||
|
||
domainToCloneID := 123 | ||
base.MockPost(formatMockAPIPath("domains/%d/clone", domainToCloneID), fixtureData) | ||
|
||
domain, err := base.Client.CloneDomain(context.Background(), domainToCloneID, requestData) | ||
|
||
assert.NoError(t, err) | ||
|
||
assert.Equal(t, "linodego-domain-clone.com", domain.Domain) | ||
assert.Equal(t, "[email protected]", domain.SOAEmail) | ||
} | ||
|
||
func TestDomain_Import(t *testing.T) { | ||
fixtureData, err := fixtures.GetFixture("domain_import") | ||
assert.NoError(t, err) | ||
|
||
var base ClientBaseCase | ||
base.SetUp(t) | ||
defer base.TearDown(t) | ||
|
||
requestData := linodego.DomainImportOptions{ | ||
Domain: "linodego-domain-import.com", | ||
RemoteNameserver: "linodego-domain-import-nameserver.com", | ||
} | ||
|
||
base.MockPost("domains/import", fixtureData) | ||
|
||
domain, err := base.Client.ImportDomain(context.Background(), requestData) | ||
|
||
assert.NoError(t, err) | ||
|
||
assert.Equal(t, "example.org", domain.Domain) | ||
assert.Equal(t, "[email protected]", domain.SOAEmail) | ||
} |
Oops, something went wrong.