Skip to content

Running Unit Tests on Development Machines

Jonathan Owens edited this page Jun 4, 2026 · 5 revisions

As defined in the /emergency-alerts-api/Makefile, the API's unit tests can be invoked with the command make test. However, the required database integration complicates this process.

The following are some of the problems encountered (and may also include ad-hoc fixes that individual developers have implemented to achieve a running test suite):

  1. Test failures due to timezone variances (typically occurring when we switch to BST):

Failing test: test_get_broadcast_messages_for_service_with_user

assert response_service_1["broadcast_messages"][0]["id"] == str(bm1.id) E AssertionError: assert 'c1c4eff5-0e3...-1f013716f0c1' == '1a715e9c-3cc...-f5d535bd3855' E - 1a715e9c-3cc2-4987-b7aa-f5d535bd3855 E + c1c4eff5-0e3b-4f38-9f8c-1f013716f0c1

Failing test: test_get_publish_tasks_returns_ongoing_publish_tasks

assert "ongoing" in result E AssertionError: assert 'ongoing' in {'failed': {'publish-all': ['publish-all_origin1_123'], 'publish-dynamic': ['publish-dynamic_origin2_124']}}`

Solution: Add TZ=UTC to your environment.sh file


  1. add new issue here

Clone this wiki locally