DRY-up email revalidation check

Previously this was duplicated between the "two_factor" and the
"webauthn" views, and required more test setup. This DRYs up the
check and tests it once, using mocks to simplify the view tests.

As part of DRYing up the check into a util module, I've also moved
the "is_less_than_days_ago" function it uses.
This commit is contained in:
Ben Thorner
2021-06-14 12:40:12 +01:00
parent bf2e6802bf
commit c17d438de8
12 changed files with 97 additions and 75 deletions

View File

@@ -13,8 +13,9 @@ from app.models import JSONModel, ModelList, PaginatedModelList
from app.notify_client.job_api_client import job_api_client
from app.notify_client.notification_api_client import notification_api_client
from app.notify_client.service_api_client import service_api_client
from app.utils import is_less_than_days_ago, set_status_filters
from app.utils import set_status_filters
from app.utils.letters import get_letter_printing_statement
from app.utils.time import is_less_than_days_ago
class Job(JSONModel):