Skip to content

Commit

Permalink
Fixes for enable/disable mac (#14)
Browse files Browse the repository at this point in the history
Add tests for enable/disable MAC

Co-authored-by: Edward Delaporte <[email protected]>
Co-authored-by: Michelle Pitcel <[email protected]>
Co-authored-by: Tyler Turner <[email protected]>
Co-authored-by: Zach Carrington <[email protected]>
  • Loading branch information
4 people authored Aug 5, 2024
1 parent 298e9d3 commit 384db20
Show file tree
Hide file tree
Showing 8 changed files with 578 additions and 22 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## Unreleased

### Added

- Add `normalize_mac_address`, `hyphenate_mac` utilities
- Add functions: `test_connectivity`, `get_info_for_mac_address`, `get_mac_id`, `set_mac_address`, `enable_mac_address`, `disable_mac_address`

### Changed
### Removed
100 changes: 100 additions & 0 deletions cassettes/test_404_disable_mac.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
interactions:
- request:
body: '{"grant_type": "password", "username": "JOE", "password": "NOTAPASSWORD",
"client_id": "FAKEID", "client_secret": "NOTASECRET"}'
headers:
Accept:
- '*/*'
Accept-Encoding:
- gzip, deflate
Connection:
- keep-alive
Content-Length:
- '238'
Content-Type:
- application/json
User-Agent:
- python-requests/2.32.3
method: POST
uri: https://notauri.edu/api/oauth
response:
body:
string: '{"access_token": "NOTASECRET"}'
headers:
Cache-Control:
- no-store
Connection:
- Keep-Alive
Content-Length:
- '172'
Content-Type:
- application/json
Date:
- Mon, 05 Aug 2024 16:40:43 GMT
Expires:
- Thu, 19 Nov 1981 08:52:00 GMT
Keep-Alive:
- timeout=4, max=500
Pragma:
- no-cache
Server:
- Apache
Set-Cookie: NO-COOKIE-FOR-YOU
Vary:
- X-Forwarded-For
X-Content-Type-Options:
- nosniff
X-XSS-Protection:
- 1;mode=block
status:
code: 200
message: OK
- request:
body: null
headers:
Accept:
- application/json
Accept-Encoding:
- gzip, deflate
Authorization:
- Bearer FAKE_TOKEN
Connection:
- keep-alive
User-Agent:
- python-requests/2.32.3
method: GET
uri: https://notauri.edu/api/endpoint/mac-address/deadbeef1234
response:
body:
string: '{"type":"http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html","title":"Not
Found","status":404,"detail":"Object not found"}'
headers:
Cache-Control:
- no-store, no-cache, must-revalidate
Connection:
- Keep-Alive
Content-Length:
- '126'
Content-Type:
- application/problem+json
Date:
- Mon, 05 Aug 2024 16:40:43 GMT
Expires:
- Thu, 19 Nov 1981 08:52:00 GMT
Keep-Alive:
- timeout=4, max=500
Pragma:
- no-cache
Server:
- Apache
Set-Cookie: NO-COOKIE-FOR-YOU
Vary:
- X-Forwarded-For
X-Content-Type-Options:
- nosniff
X-XSS-Protection:
- 1;mode=block
status:
code: 404
message: Not Found
version: 1
100 changes: 100 additions & 0 deletions cassettes/test_404_enable_mac.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
interactions:
- request:
body: '{"grant_type": "password", "username": "JOE", "password": "NOTAPASSWORD",
"client_id": "FAKEID", "client_secret": "NOTASECRET"}'
headers:
Accept:
- '*/*'
Accept-Encoding:
- gzip, deflate
Connection:
- keep-alive
Content-Length:
- '238'
Content-Type:
- application/json
User-Agent:
- python-requests/2.32.3
method: POST
uri: https://notauri.edu/api/oauth
response:
body:
string: '{"access_token": "NOTASECRET"}'
headers:
Cache-Control:
- no-store
Connection:
- Keep-Alive
Content-Length:
- '172'
Content-Type:
- application/json
Date:
- Mon, 05 Aug 2024 16:40:44 GMT
Expires:
- Thu, 19 Nov 1981 08:52:00 GMT
Keep-Alive:
- timeout=4, max=500
Pragma:
- no-cache
Server:
- Apache
Set-Cookie: NO-COOKIE-FOR-YOU
Vary:
- X-Forwarded-For
X-Content-Type-Options:
- nosniff
X-XSS-Protection:
- 1;mode=block
status:
code: 200
message: OK
- request:
body: null
headers:
Accept:
- application/json
Accept-Encoding:
- gzip, deflate
Authorization:
- Bearer FAKE_TOKEN
Connection:
- keep-alive
User-Agent:
- python-requests/2.32.3
method: GET
uri: https://notauri.edu/api/endpoint/mac-address/deadbeef1234
response:
body:
string: '{"type":"http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html","title":"Not
Found","status":404,"detail":"Object not found"}'
headers:
Cache-Control:
- no-store, no-cache, must-revalidate
Connection:
- Keep-Alive
Content-Length:
- '126'
Content-Type:
- application/problem+json
Date:
- Mon, 05 Aug 2024 16:40:44 GMT
Expires:
- Thu, 19 Nov 1981 08:52:00 GMT
Keep-Alive:
- timeout=4, max=500
Pragma:
- no-cache
Server:
- Apache
Set-Cookie: NO-COOKIE-FOR-YOU
Vary:
- X-Forwarded-For
X-Content-Type-Options:
- nosniff
X-XSS-Protection:
- 1;mode=block
status:
code: 404
message: Not Found
version: 1
154 changes: 154 additions & 0 deletions cassettes/test_disable_mac.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
interactions:
- request:
body: '{"grant_type": "password", "username": "JOE", "password": "NOTAPASSWORD",
"client_id": "FAKEID", "client_secret": "NOTASECRET"}'
headers:
Accept:
- '*/*'
Accept-Encoding:
- gzip, deflate
Connection:
- keep-alive
Content-Length:
- '238'
Content-Type:
- application/json
User-Agent:
- python-requests/2.32.3
method: POST
uri: https://notauri.edu/api/oauth
response:
body:
string: '{"access_token": "NOTASECRET"}'
headers:
Cache-Control:
- no-store
Connection:
- Keep-Alive
Content-Length:
- '172'
Content-Type:
- application/json
Date:
- Mon, 05 Aug 2024 16:31:44 GMT
Expires:
- Thu, 19 Nov 1981 08:52:00 GMT
Keep-Alive:
- timeout=4, max=500
Pragma:
- no-cache
Server:
- Apache
Set-Cookie: NO-COOKIE-FOR-YOU
Vary:
- X-Forwarded-For
X-Content-Type-Options:
- nosniff
X-XSS-Protection:
- 1;mode=block
status:
code: 200
message: OK
- request:
body: null
headers:
Accept:
- application/json
Accept-Encoding:
- gzip, deflate
Authorization:
- Bearer FAKE_TOKEN
Connection:
- keep-alive
User-Agent:
- python-requests/2.32.3
method: GET
uri: https://notauri.edu/api/endpoint/mac-address/123123123123
response:
body:
string: '{"id":4524,"mac_address":"123123123123","status":"Known","randomized_mac":true,"attributes":{},"added_at":"Nov
15, 2023 14:52:34 CST","updated_at":"Aug 05, 2024 11:27:32 CDT","_stuff":"deleted"}'
headers:
Cache-Control:
- no-store, no-cache, must-revalidate
Connection:
- Keep-Alive
Content-Length:
- '267'
Content-Type:
- application/hal+json
Date:
- Mon, 05 Aug 2024 16:31:45 GMT
Expires:
- Thu, 19 Nov 1981 08:52:00 GMT
Keep-Alive:
- timeout=4, max=500
Pragma:
- no-cache
Server:
- Apache
Set-Cookie: NO-COOKIE-FOR-YOU
Vary:
- X-Forwarded-For
X-Content-Type-Options:
- nosniff
X-XSS-Protection:
- 1;mode=block
status:
code: 200
message: OK
- request:
body: '{"id": 4524, "mac_address": "123123123123", "status": "Disabled", "attributes":
{"Disabled By": "TESTING", "Disabled Reason": "Still testing..."}}'
headers:
Accept:
- application/json
Accept-Encoding:
- gzip, deflate
Authorization:
- Bearer FAKE_TOKEN
Connection:
- keep-alive
Content-Length:
- '146'
Content-Type:
- application/json
User-Agent:
- python-requests/2.32.3
method: PUT
uri: https://notauri.edu/api/endpoint/4524
response:
body:
string: '{"id":4524,"mac_address":"123123123123","status":"Disabled","randomized_mac":true,"attributes":{"Disabled
By":"TESTING","Disabled Reason":"Still testing..."},"added_at":"Nov 15, 2023
14:52:34 CST","updated_at":"Aug 05, 2024 11:31:45 CDT","stuff":"deleted"}'
headers:
Cache-Control:
- no-store, no-cache, must-revalidate
Connection:
- Keep-Alive
Content-Length:
- '330'
Content-Type:
- application/hal+json
Date:
- Mon, 05 Aug 2024 16:31:45 GMT
Expires:
- Thu, 19 Nov 1981 08:52:00 GMT
Keep-Alive:
- timeout=4, max=500
Pragma:
- no-cache
Server:
- Apache
Set-Cookie: NO-COOKIE-FOR-YOU
Vary:
- X-Forwarded-For
X-Content-Type-Options:
- nosniff
X-XSS-Protection:
- 1;mode=block
status:
code: 200
message: OK
version: 1
Loading

0 comments on commit 384db20

Please sign in to comment.