Skip to content

Commit

Permalink
Time simulation test
Browse files Browse the repository at this point in the history
  • Loading branch information
egeakman committed Jul 1, 2024
1 parent 3d6eafd commit 1ccf014
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions tests/program_notifications/test_program_connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,10 +193,10 @@ async def test_get_now_with_simulation(program_connector):
simulated_start_time = datetime(2024, 7, 10, 8, 0, 0, tzinfo=timezone.utc)
program_connector._simulated_start_time = simulated_start_time
program_connector._real_start_time = datetime.now(tz=timezone.utc)
program_connector._time_multiplier = -60 # time goes backwards

# The simulated time should be less than the current time since the time is going backwards
assert await program_connector._get_now() < simulated_start_time
# Exaggerate how fast the time is ticking to ensure the test is valid
program_connector._time_multiplier = 1000
assert await program_connector._get_now() > simulated_start_time


@pytest.mark.asyncio
Expand Down

0 comments on commit 1ccf014

Please sign in to comment.