Files
notifications-admin/tests/app/main/test_choose_time_form.py
Chris Hill-Scott 225a61ddd3 Add a component for picking the time to send a job
Users need to pick a time in the next 24hrs, or send a file immediately.

Rationale for this is a bit lost in time-before-holiday, but generally:

‘Now’ and ‘later’ as the inital choices makes it really clear what
this feature is about conceptually.

The choice of times is absolute, eg ‘1pm’ not ‘in 3 hours’
2016-08-31 16:58:09 +01:00

23 lines
597 B
Python

import pytest
from app.main.forms import ChooseTimeForm
from freezegun import freeze_time
@freeze_time("2016-01-01 11:09:00.061258")
def test_form_contains_next_24h(app_):
choices = ChooseTimeForm().scheduled_for.choices
assert choices[0] == ('', 'Now')
assert choices[1] == ('2016-01-01T12:00:00.061258', 'Midday')
assert choices[23] == ('2016-01-02T10:00:00.061258', '10am')
with pytest.raises(IndexError):
assert choices[24]
@freeze_time("2016-01-01 11:09:00.061258")
def test_form_defaults_to_now(app_):
assert ChooseTimeForm().scheduled_for.data == ''