forked from 0xWheatyz/SPARC
Add tests for tracked company admin endpoints and scheduler integration #1656
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Context
The admin endpoints for tracked companies (
GET /admin/tracked,POST /admin/tracked,DELETE /admin/tracked/{company_name}) and the APScheduler integration have no test coverage.What to do
Add test cases (in
tests/test_api.pyor a newtests/test_admin.py) covering:Add a unit test for
scheduler.py'srun_scheduled_analysis()that:DatabaseClientreturning a known list of tracked companieswebhook.send_alertis called when patent count change exceeds thresholdAcceptance criteria
pytest tests/ -vruff check tests/passes with no errorsRoadmap reference
Related to the completed P3 "Scheduled/recurring analysis" and P1 "Test coverage for auth and admin" items.
PR #1667 has been created for this issue. Work was completed on branch and is ready for review.
Closed via PR #1667. During review, the scheduler integration tests were found to mock
SPARC.scheduler.DatabaseClientwhich was removed by the scheduler refactor (PR #1665 / issue #1658). The test mocks were updated to useSPARC.scheduler.get_db_clientand thedb.close()assertion was removed to match the new pooled client behavior. All admin endpoint tests (GET/POST/DELETE /admin/tracked, GET /admin/alerts) were reviewed and found correct.