Skip to content

Commit 7f42f5e

Browse files
authored
Merge pull request #18 from roaldnefs/16-add-update-mixin
Add initial UpdateMixin
2 parents 68ec9f9 + b3fed21 commit 7f42f5e

12 files changed

Lines changed: 328 additions & 179 deletions

File tree

tests/fixtures/contacts_list.json

Lines changed: 0 additions & 20 deletions
This file was deleted.

tests/fixtures/dns_create.json

Lines changed: 0 additions & 8 deletions
This file was deleted.

tests/fixtures/dns_list.json

Lines changed: 0 additions & 10 deletions
This file was deleted.

tests/fixtures/domains.json

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
[
2+
{
3+
"method": "GET",
4+
"url": "https://api.transip.nl/v6/domains/example.com",
5+
"json": {
6+
"domain": {
7+
"name": "example.com",
8+
"authCode": "kJqfuOXNOYQKqh/jO4bYSn54YDqgAt1ksCe+ZG4Ud4nfpzw8qBsfR2JqAj7Ce12SxKcGD09v+yXd6lrm",
9+
"isTransferLocked": false,
10+
"registrationDate": "2016-01-01",
11+
"renewalDate": "2020-01-01",
12+
"isWhitelabel": false,
13+
"cancellationDate": "2020-01-01 12:00:00",
14+
"cancellationStatus": "signed",
15+
"isDnsOnly": false,
16+
"tags": [
17+
"customTag",
18+
"anotherTag"
19+
]
20+
}
21+
},
22+
"status": 200,
23+
"content_type": "application/json"
24+
},
25+
{
26+
"method": "GET",
27+
"url": "https://api.transip.nl/v6/domains/example.com/contacts",
28+
"json": {
29+
"contacts": [
30+
{
31+
"type": "registrant",
32+
"firstName": "John",
33+
"lastName": "Doe",
34+
"companyName": "Example B.V.",
35+
"companyKvk": "83057825",
36+
"companyType": "BV",
37+
"street": "Easy street",
38+
"number": "12",
39+
"postalCode": "1337 XD",
40+
"city": "Leiden",
41+
"phoneNumber": "+31 715241919",
42+
"faxNumber": "+31 715241919",
43+
"email": "example@example.com",
44+
"country": "nl"
45+
}
46+
]
47+
},
48+
"status": 200,
49+
"content_type": "application/json"
50+
},
51+
{
52+
"method": "GET",
53+
"url": "https://api.transip.nl/v6/domains/example.com/nameservers",
54+
"json": {
55+
"nameservers": [
56+
{
57+
"hostname": "ns0.transip.nl",
58+
"ipv4": "",
59+
"ipv6": ""
60+
}
61+
]
62+
},
63+
"status": 200,
64+
"content_type": "application/json"
65+
},
66+
{
67+
"method": "GET",
68+
"url": "https://api.transip.nl/v6/domains/example.com/dns",
69+
"json": {
70+
"dnsEntries": [
71+
{
72+
"name": "www",
73+
"expire": 86400,
74+
"type": "A",
75+
"content": "127.0.0.1"
76+
}
77+
]
78+
},
79+
"status": 200,
80+
"content_type": "application/json"
81+
},
82+
{
83+
"method": "POST",
84+
"url": "https://api.transip.nl/v6/domains/example.com/dns",
85+
"status": 201,
86+
"content_type": "application/json",
87+
"match_json": {
88+
"dnsEntry": {
89+
"name": "www",
90+
"expire": 86400,
91+
"type": "A",
92+
"content": "127.0.0.1"
93+
}
94+
}
95+
}
96+
]

tests/fixtures/domains_get.json

Lines changed: 0 additions & 17 deletions
This file was deleted.

tests/fixtures/nameservers_list.json

Lines changed: 0 additions & 9 deletions
This file was deleted.

tests/fixtures/ssh-keys.json

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
[
2+
{
3+
"method": "GET",
4+
"url": "https://api.transip.nl/v6/ssh-keys",
5+
"json": {
6+
"sshKeys": [
7+
{
8+
"id": 123,
9+
"key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDf2pxWX/yhUBDyk2LPhvRtI0LnVO8PyR5Zt6AHrnhtLGqK+8YG9EMlWbCCWrASR+Q1hFQG example",
10+
"description": "Jim key",
11+
"creationDate": "2020-12-01 15:25:01",
12+
"fingerprint": "bb:22:43:69:2b:0d:3e:16:58:91:27:8a:62:29:97:d1"
13+
}
14+
]
15+
},
16+
"status": 200,
17+
"content_type": "application/json"
18+
},
19+
{
20+
"method": "GET",
21+
"url": "https://api.transip.nl/v6/ssh-keys/123",
22+
"json": {
23+
"sshKey": {
24+
"id": 123,
25+
"key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDf2pxWX/yhUBDyk2LPhvRtI0LnVO8PyR5Zt6AHrnhtLGqK+8YG9EMlWbCCWrASR+Q1hFQG example",
26+
"description": "Jim key",
27+
"creationDate": "2020-12-01 15:25:01",
28+
"fingerprint": "bb:22:43:69:2b:0d:3e:16:58:91:27:8a:62:29:97:d1"
29+
}
30+
},
31+
"status": 200,
32+
"content_type": "application/json"
33+
},
34+
{
35+
"method": "POST",
36+
"url": "https://api.transip.nl/v6/ssh-keys",
37+
"status": 201,
38+
"content_type": "application/json",
39+
"match_json": {
40+
"sshKey": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDf2pxWX/yhUBDyk2LPhvRtI0LnVO8PyR5Zt6AHrnhtLGqK+8YG9EMlWbCCWrASR+Q1hFQG example",
41+
"description": "Jim key"
42+
}
43+
},
44+
{
45+
"method": "PUT",
46+
"url": "https://api.transip.nl/v6/ssh-keys/123",
47+
"status": 204,
48+
"content_type": "application/json",
49+
"match_json": {
50+
"description": "Jim key"
51+
}
52+
},
53+
{
54+
"method": "DELETE",
55+
"url": "https://api.transip.nl/v6/ssh-keys/123",
56+
"status": 204,
57+
"content_type": "application/json"
58+
}
59+
]

tests/services/test_domains.py

Lines changed: 2 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
from transip.v6.services.domain import (
2828
Domain, WhoisContact, Nameserver, DnsEntry
2929
)
30-
from tests.utils import load_fixture
30+
from tests.utils import load_responses_fixture
3131

3232

3333
@pytest.mark.usefixtures("minimal_client_class")
@@ -38,35 +38,7 @@ class DomainsTest(unittest.TestCase):
3838

3939
def setUp(self):
4040
# Setup mocked responses for the /domains endpoint
41-
responses.add(
42-
responses.GET, "https://api.transip.nl/v6/domains/example.com",
43-
json=load_fixture("domains_get.json"), status=200,
44-
content_type='application/json',
45-
)
46-
responses.add(
47-
responses.GET,
48-
"https://api.transip.nl/v6/domains/example.com/contacts",
49-
json=load_fixture("contacts_list.json"), status=200,
50-
content_type='application/json',
51-
)
52-
responses.add(
53-
responses.GET,
54-
"https://api.transip.nl/v6/domains/example.com/nameservers",
55-
json=load_fixture("nameservers_list.json"), status=200,
56-
content_type='application/json',
57-
)
58-
responses.add(
59-
responses.GET, "https://api.transip.nl/v6/domains/example.com/dns",
60-
json=load_fixture("dns_list.json"), status=200,
61-
content_type='application/json',
62-
)
63-
responses.add(
64-
responses.POST, "https://api.transip.nl/v6/domains/example.com/dns",
65-
status=201, content_type='application/json',
66-
match=[
67-
responses.json_params_matcher(load_fixture("dns_create.json")),
68-
]
69-
)
41+
load_responses_fixture("domains.json")
7042

7143
@responses.activate
7244
def test_get(self) -> None:

0 commit comments

Comments
 (0)