Skip to content

Commit 72a3d34

Browse files
committed
tests(instance): migrate user_data tests to pytest
1 parent 8bca2f9 commit 72a3d34

File tree

4 files changed

+437
-0
lines changed

4 files changed

+437
-0
lines changed
Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
interactions:
2+
- request:
3+
body: '{"project": "11111111-1111-1111-1111-111111111111", "commercial_type":
4+
"DEV1-S", "name": "test-sdk-python-fixture", "dynamic_ip_required": false, "image":
5+
"c00ae53c-1e29-4087-a384-47f3c5c1cd84", "protected": false, "boot_type": "local"}'
6+
headers:
7+
Content-Length:
8+
- '236'
9+
user-agent:
10+
- scaleway-sdk-python/2.0.0
11+
method: POST
12+
uri: https://api.scaleway.com/instance/v1/zones/fr-par-1/servers
13+
response:
14+
body:
15+
string: '{"server": {"id": "66a3b25b-4518-43c3-9e61-33b82873d617", "name": "test-sdk-python-fixture",
16+
"arch": "x86_64", "commercial_type": "DEV1-S", "boot_type": "local", "organization":
17+
"11111111-1111-1111-1111-111111111111", "project": "11111111-1111-1111-1111-111111111111",
18+
"hostname": "test-sdk-python-fixture", "image": {"id": "c00ae53c-1e29-4087-a384-47f3c5c1cd84",
19+
"name": "Ubuntu 20.04 Focal Fossa", "organization": "11111111-1111-1111-1111-111111111111",
20+
"project": "11111111-1111-1111-1111-111111111111", "root_volume": {"id": "6644dfd6-0731-45cc-a581-62f561eff7bf",
21+
"name": "Ubuntu 20.04 Focal Fossa", "volume_type": "l_ssd", "size": 10000000000},
22+
"extra_volumes": {}, "public": true, "arch": "x86_64", "creation_date": "2025-02-03T13:36:50.774356+00:00",
23+
"modification_date": "2025-02-03T13:36:50.774356+00:00", "default_bootscript":
24+
null, "from_server": "", "state": "available", "tags": [], "zone": "fr-par-1"},
25+
"volumes": {"0": {"boot": false, "id": "bda6aff6-7ca2-41de-a3fb-47be986c5c0a",
26+
"name": "Ubuntu 20.04 Focal Fossa", "volume_type": "l_ssd", "export_uri":
27+
null, "organization": "11111111-1111-1111-1111-111111111111", "project": "11111111-1111-1111-1111-111111111111",
28+
"server": {"id": "66a3b25b-4518-43c3-9e61-33b82873d617", "name": "test-sdk-python-fixture"},
29+
"size": 20000000000, "state": "available", "creation_date": "2025-09-16T17:38:27.303680+00:00",
30+
"modification_date": "2025-09-16T17:38:27.303680+00:00", "tags": [], "zone":
31+
"fr-par-1"}}, "tags": [], "state": "stopped", "protected": false, "state_detail":
32+
"", "public_ip": null, "public_ips": [], "mac_address": "de:00:00:c8:be:d7",
33+
"routed_ip_enabled": true, "ipv6": null, "extra_networks": [], "dynamic_ip_required":
34+
false, "enable_ipv6": false, "private_ip": null, "creation_date": "2025-09-16T17:38:27.303680+00:00",
35+
"modification_date": "2025-09-16T17:38:27.303680+00:00", "bootscript": null,
36+
"security_group": {"id": "1c1fc99f-b2de-408d-9eb0-da801a3e2744", "name": "Default
37+
security group"}, "location": null, "maintenances": [], "allowed_actions":
38+
["poweron", "backup"], "placement_group": null, "private_nics": [], "zone":
39+
"fr-par-1", "filesystems": [], "end_of_service": false}}'
40+
headers:
41+
content-length:
42+
- '2163'
43+
date:
44+
- Tue, 16 Sep 2025 17:38:27 GMT
45+
location:
46+
- https://api.scaleway.com/instance/v1/zones/fr-par-1/servers/66a3b25b-4518-43c3-9e61-33b82873d617
47+
server:
48+
- Scaleway API Gateway (fr-par-2;edge02)
49+
x-request-id:
50+
- cf1425a5-4c54-464b-bfa3-b175537ec160
51+
status:
52+
code: 201
53+
message: Created
54+
- request:
55+
body: '{}'
56+
headers:
57+
Content-Length:
58+
- '2'
59+
user-agent:
60+
- scaleway-sdk-python/2.0.0
61+
method: GET
62+
uri: https://api.scaleway.com/instance/v1/zones/fr-par-1/servers/66a3b25b-4518-43c3-9e61-33b82873d617
63+
response:
64+
body:
65+
string: '{"server": {"id": "66a3b25b-4518-43c3-9e61-33b82873d617", "name": "test-sdk-python-fixture",
66+
"arch": "x86_64", "commercial_type": "DEV1-S", "boot_type": "local", "organization":
67+
"11111111-1111-1111-1111-111111111111", "project": "11111111-1111-1111-1111-111111111111",
68+
"hostname": "test-sdk-python-fixture", "image": {"id": "c00ae53c-1e29-4087-a384-47f3c5c1cd84",
69+
"name": "Ubuntu 20.04 Focal Fossa", "organization": "11111111-1111-1111-1111-111111111111",
70+
"project": "11111111-1111-1111-1111-111111111111", "root_volume": {"id": "6644dfd6-0731-45cc-a581-62f561eff7bf",
71+
"name": "Ubuntu 20.04 Focal Fossa", "volume_type": "l_ssd", "size": 10000000000},
72+
"extra_volumes": {}, "public": true, "arch": "x86_64", "creation_date": "2025-02-03T13:36:50.774356+00:00",
73+
"modification_date": "2025-02-03T13:36:50.774356+00:00", "default_bootscript":
74+
null, "from_server": "", "state": "available", "tags": [], "zone": "fr-par-1"},
75+
"volumes": {"0": {"boot": false, "id": "bda6aff6-7ca2-41de-a3fb-47be986c5c0a",
76+
"name": "Ubuntu 20.04 Focal Fossa", "volume_type": "l_ssd", "export_uri":
77+
null, "organization": "11111111-1111-1111-1111-111111111111", "project": "11111111-1111-1111-1111-111111111111",
78+
"server": {"id": "66a3b25b-4518-43c3-9e61-33b82873d617", "name": "test-sdk-python-fixture"},
79+
"size": 20000000000, "state": "available", "creation_date": "2025-09-16T17:38:27.303680+00:00",
80+
"modification_date": "2025-09-16T17:38:27.303680+00:00", "tags": [], "zone":
81+
"fr-par-1"}}, "tags": [], "state": "stopped", "protected": false, "state_detail":
82+
"", "public_ip": null, "public_ips": [], "mac_address": "de:00:00:c8:be:d7",
83+
"routed_ip_enabled": true, "ipv6": null, "extra_networks": [], "dynamic_ip_required":
84+
false, "enable_ipv6": false, "private_ip": null, "creation_date": "2025-09-16T17:38:27.303680+00:00",
85+
"modification_date": "2025-09-16T17:38:27.303680+00:00", "bootscript": null,
86+
"security_group": {"id": "1c1fc99f-b2de-408d-9eb0-da801a3e2744", "name": "Default
87+
security group"}, "location": null, "maintenances": [], "allowed_actions":
88+
["poweron", "backup"], "placement_group": null, "private_nics": [], "zone":
89+
"fr-par-1", "filesystems": [], "end_of_service": false}}'
90+
headers:
91+
content-length:
92+
- '2163'
93+
date:
94+
- Tue, 16 Sep 2025 17:38:30 GMT
95+
server:
96+
- Scaleway API Gateway (fr-par-2;edge03)
97+
x-request-id:
98+
- b5cdd266-e8db-4235-9191-80b4fe13dc4b
99+
status:
100+
code: 200
101+
message: OK
102+
- request:
103+
body: '{}'
104+
headers:
105+
Content-Length:
106+
- '2'
107+
user-agent:
108+
- scaleway-sdk-python/2.0.0
109+
method: DELETE
110+
uri: https://api.scaleway.com/instance/v1/zones/fr-par-1/servers/66a3b25b-4518-43c3-9e61-33b82873d617
111+
response:
112+
body:
113+
string: ''
114+
headers:
115+
date:
116+
- Tue, 16 Sep 2025 17:38:47 GMT
117+
server:
118+
- Scaleway API Gateway (fr-par-2;edge01)
119+
x-request-id:
120+
- c35b3c38-2ac3-448a-96ce-df5674242d5f
121+
status:
122+
code: 204
123+
message: No Content
124+
version: 1
Lines changed: 188 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,188 @@
1+
interactions:
2+
- request:
3+
body: '{}'
4+
headers:
5+
Content-Length:
6+
- '2'
7+
user-agent:
8+
- scaleway-sdk-python/2.0.0
9+
method: GET
10+
uri: https://api.scaleway.com/instance/v1/zones/fr-par-1/servers/66a3b25b-4518-43c3-9e61-33b82873d617/user_data
11+
response:
12+
body:
13+
string: '{"user_data": ["first key"]}'
14+
headers:
15+
content-length:
16+
- '28'
17+
date:
18+
- Tue, 16 Sep 2025 17:38:36 GMT
19+
server:
20+
- Scaleway API Gateway (fr-par-2;edge01)
21+
x-request-id:
22+
- da763635-45c0-4081-9b22-61db87a4f0a5
23+
status:
24+
code: 200
25+
message: OK
26+
- request:
27+
body: test content
28+
headers:
29+
Content-Length:
30+
- '12'
31+
user-agent:
32+
- scaleway-sdk-python/2.0.0
33+
method: PATCH
34+
uri: https://api.scaleway.com/instance/v1/zones/fr-par-1/servers/66a3b25b-4518-43c3-9e61-33b82873d617/user_data/second%20key
35+
response:
36+
body:
37+
string: ''
38+
headers:
39+
date:
40+
- Tue, 16 Sep 2025 17:38:37 GMT
41+
server:
42+
- Scaleway API Gateway (fr-par-2;edge02)
43+
x-request-id:
44+
- db1aacee-4d93-4447-aaa2-562df54e2440
45+
status:
46+
code: 204
47+
message: No Content
48+
- request:
49+
body: another content to test
50+
headers:
51+
Content-Length:
52+
- '23'
53+
user-agent:
54+
- scaleway-sdk-python/2.0.0
55+
method: PATCH
56+
uri: https://api.scaleway.com/instance/v1/zones/fr-par-1/servers/66a3b25b-4518-43c3-9e61-33b82873d617/user_data/third%20key
57+
response:
58+
body:
59+
string: ''
60+
headers:
61+
date:
62+
- Tue, 16 Sep 2025 17:38:37 GMT
63+
server:
64+
- Scaleway API Gateway (fr-par-2;edge02)
65+
x-request-id:
66+
- 374243f1-1d2d-4847-894a-40bfdfdc58d9
67+
status:
68+
code: 204
69+
message: No Content
70+
- request:
71+
body: content first key
72+
headers:
73+
Content-Length:
74+
- '17'
75+
user-agent:
76+
- scaleway-sdk-python/2.0.0
77+
method: PATCH
78+
uri: https://api.scaleway.com/instance/v1/zones/fr-par-1/servers/66a3b25b-4518-43c3-9e61-33b82873d617/user_data/first%20key
79+
response:
80+
body:
81+
string: ''
82+
headers:
83+
date:
84+
- Tue, 16 Sep 2025 17:38:39 GMT
85+
server:
86+
- Scaleway API Gateway (fr-par-2;edge02)
87+
x-request-id:
88+
- b4a6bb3a-6c01-4f30-8cf1-4d3d2a3e25d4
89+
status:
90+
code: 204
91+
message: No Content
92+
- request:
93+
body: '{}'
94+
headers:
95+
Content-Length:
96+
- '2'
97+
user-agent:
98+
- scaleway-sdk-python/2.0.0
99+
method: GET
100+
uri: https://api.scaleway.com/instance/v1/zones/fr-par-1/servers/66a3b25b-4518-43c3-9e61-33b82873d617/user_data
101+
response:
102+
body:
103+
string: '{"user_data": ["first key", "second key", "third key"]}'
104+
headers:
105+
content-length:
106+
- '55'
107+
date:
108+
- Tue, 16 Sep 2025 17:38:40 GMT
109+
server:
110+
- Scaleway API Gateway (fr-par-2;edge02)
111+
x-request-id:
112+
- 6bac81f0-cce6-40a6-a55e-5a920ca5aec3
113+
status:
114+
code: 200
115+
message: OK
116+
- request:
117+
body: '{"server_id": "66a3b25b-4518-43c3-9e61-33b82873d617", "key": "first key"}'
118+
headers:
119+
Content-Length:
120+
- '73'
121+
user-agent:
122+
- scaleway-sdk-python/2.0.0
123+
method: GET
124+
uri: https://api.scaleway.com/instance/v1/zones/fr-par-1/servers/66a3b25b-4518-43c3-9e61-33b82873d617/user_data/first%20key
125+
response:
126+
body:
127+
string: content first key
128+
headers:
129+
content-length:
130+
- '17'
131+
date:
132+
- Tue, 16 Sep 2025 17:38:41 GMT
133+
server:
134+
- Scaleway API Gateway (fr-par-2;edge02)
135+
x-request-id:
136+
- 3b2ad45d-108a-4867-8ea3-5c81546f7696
137+
status:
138+
code: 200
139+
message: OK
140+
- request:
141+
body: '{"server_id": "66a3b25b-4518-43c3-9e61-33b82873d617", "key": "second key"}'
142+
headers:
143+
Content-Length:
144+
- '74'
145+
user-agent:
146+
- scaleway-sdk-python/2.0.0
147+
method: GET
148+
uri: https://api.scaleway.com/instance/v1/zones/fr-par-1/servers/66a3b25b-4518-43c3-9e61-33b82873d617/user_data/second%20key
149+
response:
150+
body:
151+
string: test content
152+
headers:
153+
content-length:
154+
- '12'
155+
date:
156+
- Tue, 16 Sep 2025 17:38:42 GMT
157+
server:
158+
- Scaleway API Gateway (fr-par-2;edge02)
159+
x-request-id:
160+
- 71c301ad-28df-47d2-9c93-b76e064202f9
161+
status:
162+
code: 200
163+
message: OK
164+
- request:
165+
body: '{"server_id": "66a3b25b-4518-43c3-9e61-33b82873d617", "key": "third key"}'
166+
headers:
167+
Content-Length:
168+
- '73'
169+
user-agent:
170+
- scaleway-sdk-python/2.0.0
171+
method: GET
172+
uri: https://api.scaleway.com/instance/v1/zones/fr-par-1/servers/66a3b25b-4518-43c3-9e61-33b82873d617/user_data/third%20key
173+
response:
174+
body:
175+
string: another content to test
176+
headers:
177+
content-length:
178+
- '23'
179+
date:
180+
- Tue, 16 Sep 2025 17:38:44 GMT
181+
server:
182+
- Scaleway API Gateway (fr-par-2;edge02)
183+
x-request-id:
184+
- 557a41e4-4b5c-4f8d-95ca-fef7ba6c200c
185+
status:
186+
code: 200
187+
message: OK
188+
version: 1
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
interactions:
2+
- request:
3+
body: this-is-a-test
4+
headers:
5+
Content-Length:
6+
- '14'
7+
user-agent:
8+
- scaleway-sdk-python/2.0.0
9+
method: PATCH
10+
uri: https://api.scaleway.com/instance/v1/zones/fr-par-1/servers/66a3b25b-4518-43c3-9e61-33b82873d617/user_data/first%20key
11+
response:
12+
body:
13+
string: ''
14+
headers:
15+
date:
16+
- Tue, 16 Sep 2025 17:38:32 GMT
17+
server:
18+
- Scaleway API Gateway (fr-par-2;edge01)
19+
x-request-id:
20+
- 0ed3c2da-9914-462b-b123-f0bd05e159e2
21+
status:
22+
code: 204
23+
message: No Content
24+
- request:
25+
body: '{"server_id": "66a3b25b-4518-43c3-9e61-33b82873d617", "key": "first key"}'
26+
headers:
27+
Content-Length:
28+
- '73'
29+
user-agent:
30+
- scaleway-sdk-python/2.0.0
31+
method: GET
32+
uri: https://api.scaleway.com/instance/v1/zones/fr-par-1/servers/66a3b25b-4518-43c3-9e61-33b82873d617/user_data/first%20key
33+
response:
34+
body:
35+
string: this-is-a-test
36+
headers:
37+
content-length:
38+
- '14'
39+
date:
40+
- Tue, 16 Sep 2025 17:38:33 GMT
41+
server:
42+
- Scaleway API Gateway (fr-par-2;edge02)
43+
x-request-id:
44+
- 553413c2-2def-401d-be92-3c7e7476d070
45+
status:
46+
code: 200
47+
message: OK
48+
version: 1

0 commit comments

Comments
 (0)