mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-07-02 15:38:19 -04:00
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’
23 lines
597 B
Python
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 == ''
|