| Age | Commit message (Collapse) | Author |
|
All resources marked public in gn-auth grant group:resource:view-resource
to every user, not just anonymous callers. This test pins that contract:
an authenticated admin posting _PUBLIC_TRAIT must receive the same
view privilege as an unauthenticated caller.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Reviewed-By: Frederick M. Muriithi <fredmanglis@gmail.com>
|
|
Add two contract tests:
- data/authorisation with token: verify the response body contains an
'authorisation' key with at least one item, confirming the response
structure is the same as the no-token path.
- data/authorisation with token + unknown trait: verify NotFoundError
(404) is raised regardless of whether a token is present — the
resource lookup precedes the token check.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Reviewed-By: Frederick M. Muriithi <fredmanglis@gmail.com>
|
|
Add two contract tests:
- system/roles with token: verify response is a non-empty list of role
objects each containing a 'role_name' field.
- data/authorisation with token for public trait: verify authenticated
path returns 200 (the token path through require_oauth.acquire).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Reviewed-By: Frederick M. Muriithi <fredmanglis@gmail.com>
|
|
Add two contract tests for GET /auth/resource/system/roles:
- Without a token the response must be a list containing the
'public-view' role (verifies the no-Authorization fallback branch).
- With a valid Bearer token the endpoint must return 200.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
|
Add two contract tests for gn-auth's authorisation endpoints:
- POST /auth/data/authorisation with a non-existent trait must return 404
(gn-auth raises NotFoundError which maps to error_code=404).
- GET /auth/resource/system/roles without an Authorization header must
return 200 with the public-view role rather than 401.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Reviewed-By: Frederick M. Muriithi <fredmanglis@gmail.com>
|
|
fallback
GN2 calls POST /auth/data/authorisation per-request to check a user's
privileges on a trait's resource. Without a Bearer token the endpoint
does not 401; instead it returns public-access privileges for publicly
visible resources.
Two tests verify this contract:
test_data_authorisation_no_token_public_trait_returns_200
Confirms the endpoint returns 200 for a known public trait without
a token.
test_data_authorisation_no_token_public_trait_grants_view_privilege
Confirms the response includes 'group:resource:view-resource' —
the privilege GN2 checks to determine read access.
Co-Authored-By: Frederick Muriuki Muriithi <fmuriit1@uthsc.edu>
|
|
Extends Part 1 of the gn2 auth-flow suite with four more @login_required
checks covering the remaining metadata-edit endpoints:
test_unauthenticated_list_diffs_redirects
GET /datasets/diffs → 301/302 without session
test_unauthenticated_show_diff_redirects
GET /datasets/diffs/<name> → 301/302 without session
test_unauthenticated_approve_diff_redirects
POST /datasets/<resource_id>/diffs/<name>/approve → 301/302
test_unauthenticated_reject_diff_redirects
POST /datasets/<resource_id>/diffs/<name>/reject → 301/302
Co-Authored-By: Frederick Muriuki Muriithi <fmuriit1@uthsc.edu>
|
|
Two tests covering @login_required enforcement on the metadata-edit
blueprint (prefix: /datasets/). No credentials required — these fire
as part of the gn2 auth_flow suite.
test_unauthenticated_display_phenotype_redirects
GET /datasets/<dataset_id>/traits/<name> → 301/302 without session
test_unauthenticated_update_phenotype_redirects
POST /datasets/<dataset_id>/traits/<name> → 301/302 without session
Co-Authored-By: Frederick Muriuki Muriithi <fmuriit1@uthsc.edu>
|
|
Update all references in the smoke tests (URLs and comments) to use
the non-deprecated endpoint path.
|
|
The __population_privileges__ bug described in the docstring and assertion
message of test_resource_owner_can_edit_returns_201 is fixed. Remove the
stale description and simplify the assertion message.
Also updates the Level 4 section comment (dropped the bug parenthetical).
Reviewed-By: Frederick M. Muriithi <fredmanglis@gmail.com>
|
|
Replace the per-invocation provisioned_token("resource-owner", ...) call
in test_resource_owner_can_edit_returns_201 with a new session-scoped
resource_owner_token fixture. One user is created and torn down per test
session instead of per parametrized test invocation.
Also fix the provisioned_token teardown URL: /auth/user/delete was moved
to /auth/system/administration/users/delete.
Reviewed-By: Frederick M. Muriithi <fredmanglis@gmail.com>
|
|
Add fixtures and tests for approve/reject access control using a
systemwide-data-curator token.
conftest.py:
- data_curator_oauth2_credentials: reads role "systemwide-data-curator"
from GN_TEST_USERS_FILE; skips if absent.
- data_curator_token: requests scope "profile group resource role user".
tests/test_gn3_case_attr_access.py:
- test_data_curator_can_approve_returns_200_or_201: parametrized over
flat (/case-attribute/…) and v1 endpoints; asserts 200 or 201 (either
proves the auth check passed).
- test_data_curator_can_reject_returns_200_or_201: same for reject
paths.
Reviewed-By: Frederick M. Muriithi <fredmanglis@gmail.com>
|
|
|
|
|
|
Adds provisioning fixtures and a parametrized test that assigns
resource-owner role to a freshly created test user on the BXD
population resource, then expects 201 from both the flat and v1 edit
endpoints.
The test is RED with current code because __population_privileges__
calls GET /auth/resource/<id>/roles without a Bearer token, so
resource_privs is always empty and can_edit's resource_spec branch
is never satisfied.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
|
Two parametrized tests covering both the flat /case-attribute/ blueprint
and the v1 hierarchy for approve and reject diff operations:
- test_no_privilege_approve_returns_401: basic token must get 401
- test_no_privilege_reject_returns_401: basic token must get 401
Expected RED on the flat endpoints (using old required_access helper with
wrong privilege check); v1 endpoints already use can_apply_or_reject_edit.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Reviewed-By: Frederick M. Muriithi <fredmanglis@gmail.com>
|
|
Case-attribute names are public; tests cover only write endpoints.
Two parametrized tests over both the flat /case-attribute/ and the
new /api/v1/species/<s>/populations/<p>/case-attributes/ hierarchy:
- test_no_token_edit_returns_400: POST /edit with no token must return 400
- test_no_privilege_edit_returns_401: POST /edit with unprivileged token must return 401
Both tests are expected RED until the can_edit privilege check is added
to the flat and v1 edit endpoints.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Reviewed-By: Frederick M. Muriithi <fredmanglis@gmail.com>
|
|
Two new integration tests on POST /case-attribute/<id>/edit that go past
the auth layer and verify actual business-logic behaviour:
* test_edit_with_valid_token_returns_201 — status code must be 201
* test_edit_with_valid_token_queues_diff — body must contain
diff-status='queued'
The edit endpoint queues rather than immediately modifying the DB,
so these tests are safe to run against CD without side-effects.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Reviewed-By: Frederick M. Muriithi <fredmanglis@gmail.com>
|
|
The search endpoint occasionally returns a page without 'records found'
when GN2 is under load or just restarted (cold query path). The test
passes on immediate re-run. Mark transient as a signal for future retry
logic (e.g. pytest-rerunfailures) rather than treating failures as
definitive.
|
|
|
|
|
|
|
|
|
|
RFC 6749 section
5.2 (https://www.rfc-editor.org/rfc/rfc6749.html#section-5.2) states
that the response code for `invalid_grant` should be 400, not
401. Update the test, therefore, to check for the correct status code.
|
|
Test that POST /auth/user/masquerade/ enforces the
system:user:masquerade privilege. Both admin and basic users can
obtain a token with masquerade scope (the test client supports it),
but gn-auth's can_masquerade decorator checks the user's roles:
- Basic user → ForbiddenAccess → 403
- Admin user → can masquerade as basic user → 200
Adds three session-scoped fixtures to the test module: admin_masquerade_token,
basic_masquerade_token, and basic_user_id.
|
|
Test that GET /auth/user/ returns 200 with user fields when a valid
Bearer token is present, and 401 when no token or a garbage token is
supplied.
|
|
Test that POST /auth/token returns 401 when given a wrong password or
an unknown email address.
|
|
Test that POST /auth/token with valid admin credentials returns 200,
includes an access_token, sets token_type to bearer, and grants at
least the requested scopes.
|
|
|
|
The code in this commit was written by claude code, and is yet to be
reviewed. Expect changes once the code has been reviewed.
|