Skip to content

Commit

Permalink
Add tests for auto_policy, perm_create_domain and perm_delete_domain
Browse files Browse the repository at this point in the history
  • Loading branch information
s-hamann committed Dec 6, 2024
1 parent 8dd770c commit 204fc80
Show file tree
Hide file tree
Showing 26 changed files with 1,838 additions and 93 deletions.
14 changes: 7 additions & 7 deletions tests/cassettes/test_token/test_create_token[all_subnets].yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ interactions:
uri: https://desec.io/api/v1/auth/tokens/
response:
body:
string: '[{"id":"01234567-890a-4bcd-ef01-23456789abcd","created":"2024-01-01T00:00:00.000000Z","last_used":"2024-01-01T00:00:00.000000Z","max_age":null,"max_unused_period":null,"name":"test-main","perm_manage_tokens":true,"allowed_subnets":["0.0.0.0/0","::/0"],"is_valid":true}]'
string: '[{"id":"01234567-890a-4bcd-ef01-23456789abcd","created":"2024-01-01T00:00:00.000000Z","last_used":"2024-01-01T00:00:00.000000Z","max_age":null,"max_unused_period":null,"name":"test-main","perm_create_domain":true,"perm_delete_domain":true,"perm_manage_tokens":true,"allowed_subnets":["0.0.0.0/0","::/0"],"auto_policy":false,"is_valid":true}]'
headers:
Allow:
- GET, POST, HEAD, OPTIONS
Expand All @@ -21,7 +21,7 @@ interactions:
Connection:
- keep-alive
Content-Length:
- '269'
- '341'
Content-Type:
- application/json
Date:
Expand Down Expand Up @@ -54,7 +54,7 @@ interactions:
uri: https://desec.io/api/v1/auth/tokens/
response:
body:
string: '{"id":"000553c2-a6d6-4f19-b8cf-e68ac740ec7b","created":"2024-01-01T00:00:00.000000Z","last_used":null,"max_age":null,"max_unused_period":null,"name":"","perm_manage_tokens":false,"allowed_subnets":["0.0.0.0/0","::/0"],"is_valid":true,"token":"rD9gp7ZpbhFKqsiDxec1phUCu81j"}'
string: '{"id":"446faa79-e268-49ac-928c-49f46c568de7","created":"2024-01-01T00:00:00.000000Z","last_used":null,"max_age":null,"max_unused_period":null,"name":"","perm_create_domain":false,"perm_delete_domain":false,"perm_manage_tokens":false,"allowed_subnets":["0.0.0.0/0","::/0"],"auto_policy":false,"is_valid":true,"token":"z8hPRrNKnU7m4KjRmqRMFpRg3oFP"}'
headers:
Allow:
- GET, POST, HEAD, OPTIONS
Expand All @@ -63,7 +63,7 @@ interactions:
Connection:
- keep-alive
Content-Length:
- '273'
- '347'
Content-Type:
- application/json
Date:
Expand Down Expand Up @@ -92,7 +92,7 @@ interactions:
uri: https://desec.io/api/v1/auth/tokens/
response:
body:
string: '[{"id":"000553c2-a6d6-4f19-b8cf-e68ac740ec7b","created":"2024-01-01T00:00:00.000000Z","last_used":null,"max_age":null,"max_unused_period":null,"name":"","perm_manage_tokens":false,"allowed_subnets":["0.0.0.0/0","::/0"],"is_valid":true},{"id":"01234567-890a-4bcd-ef01-23456789abcd","created":"2024-01-01T00:00:00.000000Z","last_used":"2024-01-01T00:00:00.000000Z","max_age":null,"max_unused_period":null,"name":"test-main","perm_manage_tokens":true,"allowed_subnets":["0.0.0.0/0","::/0"],"is_valid":true}]'
string: '[{"id":"446faa79-e268-49ac-928c-49f46c568de7","created":"2024-01-01T00:00:00.000000Z","last_used":null,"max_age":null,"max_unused_period":null,"name":"","perm_create_domain":false,"perm_delete_domain":false,"perm_manage_tokens":false,"allowed_subnets":["0.0.0.0/0","::/0"],"auto_policy":false,"is_valid":true},{"id":"01234567-890a-4bcd-ef01-23456789abcd","created":"2024-01-01T00:00:00.000000Z","last_used":"2024-01-01T00:00:00.000000Z","max_age":null,"max_unused_period":null,"name":"test-main","perm_create_domain":true,"perm_delete_domain":true,"perm_manage_tokens":true,"allowed_subnets":["0.0.0.0/0","::/0"],"auto_policy":false,"is_valid":true}]'
headers:
Allow:
- GET, POST, HEAD, OPTIONS
Expand All @@ -101,7 +101,7 @@ interactions:
Connection:
- keep-alive
Content-Length:
- '504'
- '650'
Content-Type:
- application/json
Date:
Expand Down Expand Up @@ -129,7 +129,7 @@ interactions:
authorization:
- Token XXXXXXXX
method: DELETE
uri: https://desec.io/api/v1/auth/tokens/000553c2-a6d6-4f19-b8cf-e68ac740ec7b/
uri: https://desec.io/api/v1/auth/tokens/446faa79-e268-49ac-928c-49f46c568de7/
response:
body:
string: ''
Expand Down
158 changes: 158 additions & 0 deletions tests/cassettes/test_token/test_create_token[auto_policy].yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
interactions:
- request:
body: null
headers:
Accept:
- '*/*'
Accept-Encoding:
- gzip, deflate
authorization:
- Token XXXXXXXX
method: GET
uri: https://desec.io/api/v1/auth/tokens/
response:
body:
string: '[{"id":"01234567-890a-4bcd-ef01-23456789abcd","created":"2024-01-01T00:00:00.000000Z","last_used":"2024-01-01T00:00:00.000000Z","max_age":null,"max_unused_period":null,"name":"test-main","perm_create_domain":true,"perm_delete_domain":true,"perm_manage_tokens":true,"allowed_subnets":["0.0.0.0/0","::/0"],"auto_policy":false,"is_valid":true}]'
headers:
Allow:
- GET, POST, HEAD, OPTIONS
Cache-Control:
- no-cache
Connection:
- keep-alive
Content-Length:
- '341'
Content-Type:
- application/json
Date:
- Mon, 01 Jan 2024 00:00:00 GMT
Expires:
- Thu, 01 Jan 1970 00:00:01 GMT
Server:
- nginx
Strict-Transport-Security:
- max-age=31536000; includeSubDomains; preload
Vary:
- origin
status:
code: 200
message: OK
- request:
body: '{"name": "", "auto_policy": true}'
headers:
Accept:
- '*/*'
Accept-Encoding:
- gzip, deflate
Content-Length:
- '33'
Content-Type:
- application/json
authorization:
- Token XXXXXXXX
method: POST
uri: https://desec.io/api/v1/auth/tokens/
response:
body:
string: '{"id":"44f9d19e-c4d7-473c-9935-b5f6b14f3033","created":"2024-01-01T00:00:00.000000Z","last_used":null,"max_age":null,"max_unused_period":null,"name":"","perm_create_domain":false,"perm_delete_domain":false,"perm_manage_tokens":false,"allowed_subnets":["0.0.0.0/0","::/0"],"auto_policy":true,"is_valid":true,"token":"FtrXkpizj6jZmBFHanze1YYcY5Lv"}'
headers:
Allow:
- GET, POST, HEAD, OPTIONS
Cache-Control:
- no-cache
Connection:
- keep-alive
Content-Length:
- '346'
Content-Type:
- application/json
Date:
- Mon, 01 Jan 2024 00:00:00 GMT
Expires:
- Thu, 01 Jan 1970 00:00:01 GMT
Server:
- nginx
Strict-Transport-Security:
- max-age=31536000; includeSubDomains; preload
Vary:
- origin
status:
code: 201
message: Created
- request:
body: null
headers:
Accept:
- '*/*'
Accept-Encoding:
- gzip, deflate
authorization:
- Token XXXXXXXX
method: GET
uri: https://desec.io/api/v1/auth/tokens/
response:
body:
string: '[{"id":"44f9d19e-c4d7-473c-9935-b5f6b14f3033","created":"2024-01-01T00:00:00.000000Z","last_used":null,"max_age":null,"max_unused_period":null,"name":"","perm_create_domain":false,"perm_delete_domain":false,"perm_manage_tokens":false,"allowed_subnets":["0.0.0.0/0","::/0"],"auto_policy":true,"is_valid":true},{"id":"01234567-890a-4bcd-ef01-23456789abcd","created":"2024-01-01T00:00:00.000000Z","last_used":"2024-01-01T00:00:00.000000Z","max_age":null,"max_unused_period":null,"name":"test-main","perm_create_domain":true,"perm_delete_domain":true,"perm_manage_tokens":true,"allowed_subnets":["0.0.0.0/0","::/0"],"auto_policy":false,"is_valid":true}]'
headers:
Allow:
- GET, POST, HEAD, OPTIONS
Cache-Control:
- no-cache
Connection:
- keep-alive
Content-Length:
- '649'
Content-Type:
- application/json
Date:
- Mon, 01 Jan 2024 00:00:00 GMT
Expires:
- Thu, 01 Jan 1970 00:00:01 GMT
Server:
- nginx
Strict-Transport-Security:
- max-age=31536000; includeSubDomains; preload
Vary:
- origin
status:
code: 200
message: OK
- request:
body: null
headers:
Accept:
- '*/*'
Accept-Encoding:
- gzip, deflate
Content-Length:
- '0'
authorization:
- Token XXXXXXXX
method: DELETE
uri: https://desec.io/api/v1/auth/tokens/44f9d19e-c4d7-473c-9935-b5f6b14f3033/
response:
body:
string: ''
headers:
Allow:
- GET, PUT, PATCH, DELETE, HEAD, OPTIONS
Cache-Control:
- no-cache
Connection:
- keep-alive
Content-Length:
- '0'
Date:
- Mon, 01 Jan 2024 00:00:00 GMT
Expires:
- Thu, 01 Jan 1970 00:00:01 GMT
Server:
- nginx
Strict-Transport-Security:
- max-age=31536000; includeSubDomains; preload
Vary:
- origin
status:
code: 204
message: No Content
version: 1
14 changes: 7 additions & 7 deletions tests/cassettes/test_token/test_create_token[named].yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ interactions:
uri: https://desec.io/api/v1/auth/tokens/
response:
body:
string: '[{"id":"01234567-890a-4bcd-ef01-23456789abcd","created":"2024-01-01T00:00:00.000000Z","last_used":"2024-01-01T00:00:00.000000Z","max_age":null,"max_unused_period":null,"name":"test-main","perm_manage_tokens":true,"allowed_subnets":["0.0.0.0/0","::/0"],"is_valid":true}]'
string: '[{"id":"01234567-890a-4bcd-ef01-23456789abcd","created":"2024-01-01T00:00:00.000000Z","last_used":"2024-01-01T00:00:00.000000Z","max_age":null,"max_unused_period":null,"name":"test-main","perm_create_domain":true,"perm_delete_domain":true,"perm_manage_tokens":true,"allowed_subnets":["0.0.0.0/0","::/0"],"auto_policy":false,"is_valid":true}]'
headers:
Allow:
- GET, POST, HEAD, OPTIONS
Expand All @@ -21,7 +21,7 @@ interactions:
Connection:
- keep-alive
Content-Length:
- '269'
- '341'
Content-Type:
- application/json
Date:
Expand Down Expand Up @@ -54,7 +54,7 @@ interactions:
uri: https://desec.io/api/v1/auth/tokens/
response:
body:
string: '{"id":"0cafb5ef-573b-409a-9bda-47a989af3418","created":"2024-01-01T00:00:00.000000Z","last_used":null,"max_age":null,"max_unused_period":null,"name":"test-suite","perm_manage_tokens":false,"allowed_subnets":["0.0.0.0/0","::/0"],"is_valid":true,"token":"NiFoSimZ9BCD5TcQ1j2u4swUwuPL"}'
string: '{"id":"bde93c0a-5b4c-4f7c-8eca-0d995d2c61a5","created":"2024-01-01T00:00:00.000000Z","last_used":null,"max_age":null,"max_unused_period":null,"name":"test-suite","perm_create_domain":false,"perm_delete_domain":false,"perm_manage_tokens":false,"allowed_subnets":["0.0.0.0/0","::/0"],"auto_policy":false,"is_valid":true,"token":"QHUermEq31AEKydpTyHvuBSHJHfb"}'
headers:
Allow:
- GET, POST, HEAD, OPTIONS
Expand All @@ -63,7 +63,7 @@ interactions:
Connection:
- keep-alive
Content-Length:
- '283'
- '357'
Content-Type:
- application/json
Date:
Expand Down Expand Up @@ -92,7 +92,7 @@ interactions:
uri: https://desec.io/api/v1/auth/tokens/
response:
body:
string: '[{"id":"0cafb5ef-573b-409a-9bda-47a989af3418","created":"2024-01-01T00:00:00.000000Z","last_used":null,"max_age":null,"max_unused_period":null,"name":"test-suite","perm_manage_tokens":false,"allowed_subnets":["0.0.0.0/0","::/0"],"is_valid":true},{"id":"01234567-890a-4bcd-ef01-23456789abcd","created":"2024-01-01T00:00:00.000000Z","last_used":"2024-01-01T00:00:00.000000Z","max_age":null,"max_unused_period":null,"name":"test-main","perm_manage_tokens":true,"allowed_subnets":["0.0.0.0/0","::/0"],"is_valid":true}]'
string: '[{"id":"bde93c0a-5b4c-4f7c-8eca-0d995d2c61a5","created":"2024-01-01T00:00:00.000000Z","last_used":null,"max_age":null,"max_unused_period":null,"name":"test-suite","perm_create_domain":false,"perm_delete_domain":false,"perm_manage_tokens":false,"allowed_subnets":["0.0.0.0/0","::/0"],"auto_policy":false,"is_valid":true},{"id":"01234567-890a-4bcd-ef01-23456789abcd","created":"2024-01-01T00:00:00.000000Z","last_used":"2024-01-01T00:00:00.000000Z","max_age":null,"max_unused_period":null,"name":"test-main","perm_create_domain":true,"perm_delete_domain":true,"perm_manage_tokens":true,"allowed_subnets":["0.0.0.0/0","::/0"],"auto_policy":false,"is_valid":true}]'
headers:
Allow:
- GET, POST, HEAD, OPTIONS
Expand All @@ -101,7 +101,7 @@ interactions:
Connection:
- keep-alive
Content-Length:
- '514'
- '660'
Content-Type:
- application/json
Date:
Expand Down Expand Up @@ -129,7 +129,7 @@ interactions:
authorization:
- Token XXXXXXXX
method: DELETE
uri: https://desec.io/api/v1/auth/tokens/0cafb5ef-573b-409a-9bda-47a989af3418/
uri: https://desec.io/api/v1/auth/tokens/bde93c0a-5b4c-4f7c-8eca-0d995d2c61a5/
response:
body:
string: ''
Expand Down
Loading

0 comments on commit 204fc80

Please sign in to comment.