Handle submitting form without csp estimate
This commit is contained in:
parent
9f2419d334
commit
045dcef6f9
@ -88,7 +88,7 @@ class TaskOrder(Base, mixins.TimestampsMixin):
|
|||||||
)
|
)
|
||||||
elif not new_csp_estimate and self._csp_estimate:
|
elif not new_csp_estimate and self._csp_estimate:
|
||||||
self._csp_estimate = None
|
self._csp_estimate = None
|
||||||
else:
|
elif new_csp_estimate:
|
||||||
raise TypeError("Could not set csp_estimate with invalid type")
|
raise TypeError("Could not set csp_estimate with invalid type")
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
@ -59,6 +59,13 @@ class TestCSPEstimate:
|
|||||||
with pytest.raises(TypeError):
|
with pytest.raises(TypeError):
|
||||||
to.csp_estimate = "invalid"
|
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):
|
def test_removing_estimate(self):
|
||||||
attachment = Attachment(filename="sample.pdf", object_name="sample")
|
attachment = Attachment(filename="sample.pdf", object_name="sample")
|
||||||
to = TaskOrder(csp_estimate=attachment)
|
to = TaskOrder(csp_estimate=attachment)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user