Skip to content

✨ feat: add for admin IP allowlist middleware comprehensive unit tests the admin IP allowlist feature toensure correct behaviour of middleware and helper functions. - #18

Merged
alain-sv merged 3 commits into
developfrom
ADMIN_ALLOW_IPS
Mar 23, 2026
Merged

✨ feat: add for admin IP allowlist middleware comprehensive unit tests the admin IP allowlist feature toensure correct behaviour of middleware and helper functions.#18
alain-sv merged 3 commits into
developfrom
ADMIN_ALLOW_IPS

Conversation

@alain-sv

Copy link
Copy Markdown
Contributor
  • Add tests for is_admin_url_path covering root, nested and similar non-admin paths.
  • Add tests for client_ip_is_allowed covering empty env, IP matches, CIDR ranges and multiple entries.
  • tests get_effective_client_ip to prefer-ForwardedFor and fallback to theGI client address- Add integration tests using a minimal Fast app with the AdminIPAllowlistMiddleware applied to verify:
    ADMIN_ALLOWED_IPS unset allows requests.
  • Requests are blocked when client IP is not in the allowlist.
  • Requests are allowed when client IP is in the allowlist.
  • Non-admin paths remain.
  • Provide a minimal_admin_app fixture that patches storage and sets necessary app.state.server for isolated testing.

These tests improve coverage and prevent regress in IP-basedadministration access control.

…s the admin IP allowlist feature toensure correct behaviour of middleware and helper functions.

- Add tests for is_admin_url_path covering root, nested and similar non-admin paths.
- Add tests for client_ip_is_allowed covering empty env, IP matches, CIDR ranges and multiple entries.
- tests get_effective_client_ip to prefer-ForwardedFor and fallback to theGI client address- Add integration tests using a minimal Fast app with the AdminIPAllowlistMiddleware applied to verify:
 ADMIN_ALLOWED_IPS unset allows requests.
 - Requests are blocked when client IP is not in the allowlist.
 - Requests are allowed when client IP is in the allowlist.
 - Non-admin paths remain.
- Provide a minimal_admin_app fixture that patches storage and sets necessary app.state.server for isolated testing.

These tests improve coverage and prevent regress in IP-basedadministration access control.
@alain-sv
alain-sv merged commit 7a3007e into develop Mar 23, 2026
5 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.

1 participant