diff options
| author | Pjotr Prins <pjotr.public01@thebird.nl> | 2026-10-05 11:12:15 +0000 |
|---|---|---|
| committer | Pjotr Prins <pjotr.public01@thebird.nl> | 2026-10-07 08:26:56 +0200 |
| commit | 15a5c8abeb73584eeae6cae1d92176da42fa6bc3 (patch) | |
| tree | f5926ef740ef3e59b298cd99b32f093709c1e913 /test/python/test_traits.py | |
| parent | 81662183f5cad305d7c011fc53b6bb750b3b0833 (diff) | |
| download | genenetwork4-15a5c8abeb73584eeae6cae1d92176da42fa6bc3.tar.gz | |
Add tests for denying a genuinely <1-year-old non-public dataset
All four 403-deny tests so far used UTHSC_BXD_Cochlea_0225, which was a real non-public, non-embargoed dataset when first used as a fixture but is now ~20 months old -- still correctly denied (under the 5-year embargo threshold), but no longer actually tests "freshly added, private" data specifically, only "not yet old enough to auto-expire." Found UTHSC_BXD_2wk_Cochlea_0926 (public=1, confidentiality=1, created 2026-09-01, the most recently added ProbeSetFreeze in the database as of this writing) and added a parallel test alongside each existing UTHSC_BXD_Cochlea_0225 test -- dataset_probeset_info, its /values sibling, the dataset_probesets listing, and the unified /traits endpoint, in both Rust and Python -- confirming the deny path holds for data that's actually less than a year old, not just data that merely hasn't aged past 5 years yet. Verified live against the real database before adding (is_publicly_readable's two conditions -- flags and age -- both still correctly deny for this dataset; values/probeset data exists for it, so the test exercises the authorization check rather than a 404). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XDDpXvZBQat9uSgDeEMJ8d
Diffstat (limited to 'test/python/test_traits.py')
| -rw-r--r-- | test/python/test_traits.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/test/python/test_traits.py b/test/python/test_traits.py index 38bf411..6a44bd8 100644 --- a/test/python/test_traits.py +++ b/test/python/test_traits.py @@ -176,6 +176,25 @@ class TraitsTest(ServerTestCase): error = json.loads(body) self.assertEqual(error["code"], "forbidden") + def test_trait_info_recent_non_public_probeset_dataset_returns_403(self): + """Same as above, but with a dataset genuinely less than a year + old (UTHSC_BXD_Cochlea_0225 above is real but was already ~20 + months old by the time this test was written) -- the age-embargo + rule and the "not yet linked to any gn-auth resource" deny path + both need to hold for freshly-added data, not just for something + that merely hasn't aged into public yet. + UTHSC_BXD_2wk_Cochlea_0926 (public=1, confidentiality=1, created + 2026-09-01) is the most recently added ProbeSetFreeze in the + database as of this writing. + """ + self.require_fixtures() + + response, body = self.get("/traits/UTHSC_BXD_2wk_Cochlea_0926/ENSMUSG00000028180") + self.assertEqual(response.status, 403) + + error = json.loads(body) + self.assertEqual(error["code"], "forbidden") + if __name__ == "__main__": unittest.main() |
