Add a fast, offline test suite which mocks KG access

Every existing test talks to the live Knowledge Graph, so a full run takes about 14 minutes and needs a token that expires daily; CI, having no token, runs 9 of 86 tests and covers 31% of application statements.

This adds a second suite that runs offline against hand-written mocks. This suite takes <10 seconds on my laptop, and covers 92% of statements against the "live" test suite's 68%, with no module covered less well and four covered that the live suite never touches (comments, the exception handlers and /health, /projects, /me, and /vocab)

Six bugs found while writing the tests are documented as xfail(), they should be fixed soon.

Because mocks can drift from the libraries they imitate and let the suite pass while production breaks, test_mock_conformance.py compares signatures and defaults against fairgraph.KGClient

For more details, see validation_service_api/validation_service/tests/README.md.

Edited by Andrew Davison

Merge request reports

Loading