Handle submitting form without csp estimate

This commit is contained in:
Patrick Smith 2019-01-23 16:30:28 -05:00
parent 9f2419d334
commit 045dcef6f9
2 changed files with 8 additions and 1 deletions

View File

@ -88,7 +88,7 @@ class TaskOrder(Base, mixins.TimestampsMixin):
)
elif not new_csp_estimate and self._csp_estimate:
self._csp_estimate = None
else:
elif new_csp_estimate:
raise TypeError("Could not set csp_estimate with invalid type")
@property

View File

@ -59,6 +59,13 @@ class TestCSPEstimate:
with pytest.raises(TypeError):
to.csp_estimate = "invalid"
def test_setting_estimate_with_empty_value(self):
to = TaskOrder()
assert to.csp_estimate is None
to.csp_estimate = ""
assert to.csp_estimate is None
def test_removing_estimate(self):
attachment = Attachment(filename="sample.pdf", object_name="sample")
to = TaskOrder(csp_estimate=attachment)