Skip to content

Added tests for /api/token/ and /api/refresh/#661

Merged
duckduckgrayduck merged 1 commit intomasterfrom
add_token_tests
Apr 29, 2026
Merged

Added tests for /api/token/ and /api/refresh/#661
duckduckgrayduck merged 1 commit intomasterfrom
add_token_tests

Conversation

@duckduckgrayduck
Copy link
Copy Markdown
Contributor

@duckduckgrayduck duckduckgrayduck commented Apr 25, 2026

It has happened twice in recent past, where trying to get a refresh token at /api/refresh/ broke after an update of rest framework or a jwt library. These tests would give us a heads up that this breaks before we push to production.

You can test (and I've already confirmed) that making this change in reverse locally makes the tests fail locally because there is an issuer failure.

@allanlasser allanlasser temporarily deployed to squarelet-pi-add-token--zl0m31 April 25, 2026 01:20 Inactive
@duckduckgrayduck duckduckgrayduck temporarily deployed to squarelet-pi-add-token--zl0m31 April 25, 2026 01:29 Inactive
@duckduckgrayduck duckduckgrayduck temporarily deployed to squarelet-pi-add-token--zl0m31 April 25, 2026 01:44 Inactive
@duckduckgrayduck duckduckgrayduck temporarily deployed to squarelet-pi-add-token--zl0m31 April 25, 2026 01:48 Inactive
@duckduckgrayduck duckduckgrayduck temporarily deployed to squarelet-pi-add-token--zl0m31 April 25, 2026 01:52 Inactive
Also don't look for frontend assets during tests
@duckduckgrayduck duckduckgrayduck temporarily deployed to squarelet-pi-add-token--zl0m31 April 25, 2026 01:56 Inactive
@duckduckgrayduck
Copy link
Copy Markdown
Contributor Author

If you're wondering about the change in config/settings/test.py it is to fix this error:

FAILED squarelet/core/tests/test_jwt.py::TestJWTConfiguration::test_refresh_token_is_accepted - django_vite.core.exceptions.DjangoViteAssetNotFoundError: Cannot find frontend/main.ts for app=default in Vite manifest at /home/runner/work/squarelet/squarelet/frontend/dist/manifest.json
FAILED squarelet/core/tests/test_jwt.py::TestJWTConfiguration::test_refresh_token_is_rotated - django_vite.core.exceptions.DjangoViteAssetNotFoundError: Cannot find frontend/main.ts for app=default in Vite manifest at /home/runner/work/squarelet/squarelet/frontend/dist/manifest.json
FAILED squarelet/core/tests/test_jwt.py::TestJWTConfiguration::test_token_obtain_returns_access_and_refresh - django_vite.core.exceptions.DjangoViteAssetNotFoundError: Cannot find frontend/main.ts for app=default in Vite manifest at /home/runner/work/squarelet/squarelet/frontend/dist/manifest.json

which occurred in my first run of the tests on Github:
https://github.com/MuckRock/squarelet/actions/runs/24919089289/job/72977020381

The isort fix is because it would be helpful at times if it actually showed us what needs to get swapped in case we want to make a one line change in the Github editor instead of going back to cli to run inv format

@duckduckgrayduck duckduckgrayduck merged commit 6bd05fe into master Apr 29, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants