Skip to content

test: add API route tests and fix test suite (#65)#89

Open
EmmanuelNiyonshuti wants to merge 10 commits intoagstack:mainfrom
EmmanuelNiyonshuti:test/improve-test-suite
Open

test: add API route tests and fix test suite (#65)#89
EmmanuelNiyonshuti wants to merge 10 commits intoagstack:mainfrom
EmmanuelNiyonshuti:test/improve-test-suite

Conversation

@EmmanuelNiyonshuti
Copy link
Copy Markdown

This PR fixes the existing test setup and adds missing API route tests. Addresses #65

Small fixes on the existing test setup, shared fixtures were scattered across tests/fixtures/ instead of conftest.py so, I moved them there. Renamed test_jwt_token to jwt_token since the test_ prefix is for test functions. Added missing fixtures for response shapes that the new tests needed.

Added two new unit tests for get_thi in TestOpenWeatherMap , one for the default path and one for ocsm=True.

Added tests/api/ with three new test files:

  • test_data_routes.py all routes in src/api/api.py, testing 200, 500, and 403 per route
  • test_locations.py integration tests hitting the in-memory mock DB directly. Two routes that depend on MongoDB $near geospatial queries are skipped since mongomock doesn't support them
  • test_history.py both history routes. Only the cache miss path is testable for the same $near reason. Skipped tests are left in with comments for whoever picks them up later.

@EmmanuelNiyonshuti EmmanuelNiyonshuti changed the title Addresses #65 the test suite was incomplete, some fixtures were broken or misplaced, and there were no tests for the API routes. test: add API route tests and fix test suite (#65) Mar 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant