Merge pull request #301 from dod-ccpo/validate-dates

Validate that start_date is in the future
This commit is contained in:
richard-dds
2018-09-19 10:03:57 -04:00
committed by GitHub
4 changed files with 25 additions and 5 deletions

View File

@@ -114,7 +114,7 @@ class RequestFactory(Base):
fname_poc=user.first_name,
lname_poc=user.last_name,
jedi_usage="adf",
start_date=datetime.date(2018, 8, 8),
start_date=datetime.date(2050, 1, 1),
cloud_native="yes",
dollar_value=dollar_value,
dod_component=SERVICE_BRANCHES[2][1],

View File

@@ -13,7 +13,7 @@ class TestDetailsOfUseForm:
"dollar_value": "42",
"number_user_sessions": "6",
"average_daily_traffic": "0",
"start_date": "12/12/2012",
"start_date": "12/12/2050",
}
migration_data = {
"jedi_migration": "yes",
@@ -87,3 +87,11 @@ class TestDetailsOfUseForm:
request_form = DetailsOfUseForm(data=data)
assert request_form.validate()
def test_start_date_must_be_in_the_future(self):
data = {**self.form_data, **self.migration_data}
data["start_date"] = "01/01/2018"
request_form = DetailsOfUseForm(data=data)
assert not request_form.validate()
assert "Must be a date in the future." in request_form.errors["start_date"]