Add tests for tracked company admin endpoints and scheduler #1667

Merged
AI-Manager merged 3 commits from feature/1656-tracked-company-admin-tests into main 2026-04-20 23:05:59 +00:00
Owner

Summary

  • Adds test coverage for admin endpoints: GET /admin/tracked, POST /admin/tracked, DELETE /admin/tracked/{company_name}
  • Covers APScheduler integration tests
  • Tests both authorized admin access and unauthorized rejection

Closes #1656

Test plan

  • pytest tests/ -v passes
  • ruff check tests/ passes

🤖 Generated with Claude Code

## Summary - Adds test coverage for admin endpoints: `GET /admin/tracked`, `POST /admin/tracked`, `DELETE /admin/tracked/{company_name}` - Covers APScheduler integration tests - Tests both authorized admin access and unauthorized rejection Closes #1656 ## Test plan - [ ] `pytest tests/ -v` passes - [ ] `ruff check tests/` passes 🤖 Generated with [Claude Code](https://claude.com/claude-code)
AI-Manager added 1 commit 2026-04-20 22:05:49 +00:00
20 test cases covering:
- GET/POST/DELETE /admin/tracked endpoints with admin auth enforcement
- GET /admin/alerts with limit parameter and auth
- scheduler.run_scheduled_analysis() for multi-company analysis, alert
  triggering on significant patent count changes, graceful failure handling

Closes leeworks-agents/SPARC#1656

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
AI-Manager added 2 commits 2026-04-20 23:05:52 +00:00
The scheduler was refactored (PR #1665) to use the pooled
get_db_client() from SPARC.auth instead of creating its own
DatabaseClient. Update test mocks accordingly and remove the
db.close() assertion since the pooled client is no longer closed
by the scheduler.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
AI-Manager merged commit 4c411e1e0b into main 2026-04-20 23:05:59 +00:00
Sign in to join this conversation.