Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ jobs:

- name: Run unit tests
run: |
make unit
make unit
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.13
29 changes: 3 additions & 26 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,36 +1,14 @@
VENV_PYTHON:=venv/bin/python
VENV_REQS:=.requirements.venv
SRCS:=$(shell find src tests -name '*.py')

all: test

# BSD `sed` treats the `-i` option differently than Linux and others.
# Check for Mac OS X 'Darwin' and set our `-i` option accordingly.
ifeq ($(UNAME), Darwin)
# macOS (BSD sed)
SED_INPLACE := -i ''
else
# Linux and others (GNU sed)
SED_INPLACE := -i
endif

venv: requirements-test.txt
venv: requirements-test.in
rm -rf $@
python -m venv venv
$(VENV_PYTHON) -m pip install -r requirements-test.txt
$(VENV_PYTHON) -m pip install -r $^
# Install dependencies from pyproject.toml
$(VENV_PYTHON) -m pip install -e .


requirements-test.txt: export VCR_CLEANER_REPO=git+https://github.com/techservicesillinois/vcrpy-cleaner.git
requirements-test.txt: requirements-test.in
rm -rf $(VENV_REQS)
python -m venv $(VENV_REQS)
# Workaround for wheel install failures.
$(VENV_REQS)/bin/python -m pip install --upgrade pip
$(VENV_REQS)/bin/python -m pip install -r $^
$(VENV_REQS)/bin/python -m pip freeze -qqq > $@
sed $(SED_INPLACE) "s;^vcr-cleaner==.*;$(VCR_CLEANER_REPO);" $@

lint: venv .lint
.lint: $(SRCS) $(TSCS)
Expand All @@ -53,10 +31,9 @@ unit: venv
test: lint static unit

clean:
rm -rf venv $(VENV_REQS)
rm -rf .lint .static
rm -rf .mypy_cache
-find src -type d -name __pycache__ -exec rm -fr "{}" \;

force-clean: clean
rm -f requirements-test.txt
rm -rf venv
20 changes: 14 additions & 6 deletions cassettes/test_404_disable_mac.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ interactions:
Content-Type:
- application/json
User-Agent:
- python-requests/2.32.3
- python-requests/2.32.5
method: POST
uri: https://notauri.edu/api/oauth
uri: https://cleaned.example.edu/api/oauth
response:
body:
string: '{"access_token": "NOTASECRET"}'
Expand All @@ -30,7 +30,7 @@ interactions:
Content-Type:
- application/json
Date:
- Mon, 05 Aug 2024 16:40:43 GMT
- Mon, 17 Nov 2025 22:02:31 GMT
Expires:
- Thu, 19 Nov 1981 08:52:00 GMT
Keep-Alive:
Expand All @@ -44,8 +44,12 @@ interactions:
- X-Forwarded-For
X-Content-Type-Options:
- nosniff
- nosniff
X-Frame-Options:
- SAMEORIGIN
X-XSS-Protection:
- 1;mode=block
- 1;mode=block
status:
code: 200
message: OK
Expand All @@ -61,9 +65,9 @@ interactions:
Connection:
- keep-alive
User-Agent:
- python-requests/2.32.3
- python-requests/2.32.5
method: GET
uri: https://notauri.edu/api/endpoint/mac-address/deadbeef1234
uri: https://cleaned.example.edu/api/endpoint/mac-address/deadbeef1234
response:
body:
string: '{"type":"http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html","title":"Not
Expand All @@ -78,7 +82,7 @@ interactions:
Content-Type:
- application/problem+json
Date:
- Mon, 05 Aug 2024 16:40:43 GMT
- Mon, 17 Nov 2025 22:02:31 GMT
Expires:
- Thu, 19 Nov 1981 08:52:00 GMT
Keep-Alive:
Expand All @@ -92,8 +96,12 @@ interactions:
- X-Forwarded-For
X-Content-Type-Options:
- nosniff
- nosniff
X-Frame-Options:
- SAMEORIGIN
X-XSS-Protection:
- 1;mode=block
- 1;mode=block
status:
code: 404
message: Not Found
Expand Down
20 changes: 14 additions & 6 deletions cassettes/test_404_enable_mac.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ interactions:
Content-Type:
- application/json
User-Agent:
- python-requests/2.32.3
- python-requests/2.32.5
method: POST
uri: https://notauri.edu/api/oauth
uri: https://cleaned.example.edu/api/oauth
response:
body:
string: '{"access_token": "NOTASECRET"}'
Expand All @@ -30,7 +30,7 @@ interactions:
Content-Type:
- application/json
Date:
- Mon, 05 Aug 2024 16:40:44 GMT
- Mon, 17 Nov 2025 22:02:33 GMT
Expires:
- Thu, 19 Nov 1981 08:52:00 GMT
Keep-Alive:
Expand All @@ -44,8 +44,12 @@ interactions:
- X-Forwarded-For
X-Content-Type-Options:
- nosniff
- nosniff
X-Frame-Options:
- SAMEORIGIN
X-XSS-Protection:
- 1;mode=block
- 1;mode=block
status:
code: 200
message: OK
Expand All @@ -61,9 +65,9 @@ interactions:
Connection:
- keep-alive
User-Agent:
- python-requests/2.32.3
- python-requests/2.32.5
method: GET
uri: https://notauri.edu/api/endpoint/mac-address/deadbeef1234
uri: https://cleaned.example.edu/api/endpoint/mac-address/deadbeef1234
response:
body:
string: '{"type":"http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html","title":"Not
Expand All @@ -78,7 +82,7 @@ interactions:
Content-Type:
- application/problem+json
Date:
- Mon, 05 Aug 2024 16:40:44 GMT
- Mon, 17 Nov 2025 22:02:34 GMT
Expires:
- Thu, 19 Nov 1981 08:52:00 GMT
Keep-Alive:
Expand All @@ -92,8 +96,12 @@ interactions:
- X-Forwarded-For
X-Content-Type-Options:
- nosniff
- nosniff
X-Frame-Options:
- SAMEORIGIN
X-XSS-Protection:
- 1;mode=block
- 1;mode=block
status:
code: 404
message: Not Found
Expand Down
15 changes: 9 additions & 6 deletions cassettes/test_connectivity.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ interactions:
Content-Type:
- application/json
User-Agent:
- python-requests/2.32.3
- python-requests/2.32.5
method: POST
uri: https://notauri.edu/api/oauth
uri: https://cleaned.example.edu/api/oauth
response:
body:
string: '{"access_token": "CLEANED"}'
string: '{"access_token": "NOTASECRET"}'
headers:
Cache-Control:
- no-store
Expand All @@ -30,7 +30,7 @@ interactions:
Content-Type:
- application/json
Date:
- Mon, 22 Jul 2024 20:38:25 GMT
- Mon, 17 Nov 2025 22:02:28 GMT
Expires:
- Thu, 19 Nov 1981 08:52:00 GMT
Keep-Alive:
Expand All @@ -39,14 +39,17 @@ interactions:
- no-cache
Server:
- Apache
Set-Cookie:
- GSID=3cabr753nknijgm1unpfbv7eqk; path=/; secure; HttpOnly; SameSite=Lax
Set-Cookie: NO-COOKIE-FOR-YOU
Vary:
- X-Forwarded-For
X-Content-Type-Options:
- nosniff
- nosniff
X-Frame-Options:
- SAMEORIGIN
X-XSS-Protection:
- 1;mode=block
- 1;mode=block
status:
code: 200
message: OK
Expand Down
34 changes: 23 additions & 11 deletions cassettes/test_disable_mac.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ interactions:
Content-Type:
- application/json
User-Agent:
- python-requests/2.32.3
- python-requests/2.32.5
method: POST
uri: https://notauri.edu/api/oauth
uri: https://cleaned.example.edu/api/oauth
response:
body:
string: '{"access_token": "NOTASECRET"}'
Expand All @@ -30,7 +30,7 @@ interactions:
Content-Type:
- application/json
Date:
- Mon, 05 Aug 2024 16:31:44 GMT
- Mon, 17 Nov 2025 22:02:29 GMT
Expires:
- Thu, 19 Nov 1981 08:52:00 GMT
Keep-Alive:
Expand All @@ -44,8 +44,12 @@ interactions:
- X-Forwarded-For
X-Content-Type-Options:
- nosniff
- nosniff
X-Frame-Options:
- SAMEORIGIN
X-XSS-Protection:
- 1;mode=block
- 1;mode=block
status:
code: 200
message: OK
Expand All @@ -61,13 +65,13 @@ interactions:
Connection:
- keep-alive
User-Agent:
- python-requests/2.32.3
- python-requests/2.32.5
method: GET
uri: https://notauri.edu/api/endpoint/mac-address/123123123123
uri: https://cleaned.example.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"}'
15, 2023 14:52:34 CST","updated_at":"Nov 17, 2025 15:02:29 CST","_links":{"self":{"href":"https:\/\/cleaned.example.edu\/api\/endpoint\/4524"}}}'
headers:
Cache-Control:
- no-store, no-cache, must-revalidate
Expand All @@ -78,7 +82,7 @@ interactions:
Content-Type:
- application/hal+json
Date:
- Mon, 05 Aug 2024 16:31:45 GMT
- Mon, 17 Nov 2025 22:02:30 GMT
Expires:
- Thu, 19 Nov 1981 08:52:00 GMT
Keep-Alive:
Expand All @@ -92,8 +96,12 @@ interactions:
- X-Forwarded-For
X-Content-Type-Options:
- nosniff
- nosniff
X-Frame-Options:
- SAMEORIGIN
X-XSS-Protection:
- 1;mode=block
- 1;mode=block
status:
code: 200
message: OK
Expand All @@ -114,14 +122,14 @@ interactions:
Content-Type:
- application/json
User-Agent:
- python-requests/2.32.3
- python-requests/2.32.5
method: PUT
uri: https://notauri.edu/api/endpoint/4524
uri: https://cleaned.example.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"}'
14:52:34 CST","updated_at":"Nov 17, 2025 16:02:30 CST","_links":{"self":{"href":"https:\/\/cleaned.example.edu\/api\/endpoint\/4524"}}}'
headers:
Cache-Control:
- no-store, no-cache, must-revalidate
Expand All @@ -132,7 +140,7 @@ interactions:
Content-Type:
- application/hal+json
Date:
- Mon, 05 Aug 2024 16:31:45 GMT
- Mon, 17 Nov 2025 22:02:30 GMT
Expires:
- Thu, 19 Nov 1981 08:52:00 GMT
Keep-Alive:
Expand All @@ -146,8 +154,12 @@ interactions:
- X-Forwarded-For
X-Content-Type-Options:
- nosniff
- nosniff
X-Frame-Options:
- SAMEORIGIN
X-XSS-Protection:
- 1;mode=block
- 1;mode=block
status:
code: 200
message: OK
Expand Down
Loading