fix test, minor python tweaks

This commit is contained in:
Montana 2019-01-14 11:46:27 -05:00
parent 804ddc4db5
commit 676c68a243
2 changed files with 6 additions and 5 deletions

View File

@ -126,9 +126,9 @@ class UpdateTaskOrderWorkflow(ShowTaskOrderWorkflow):
# don't save other text in DB unless "other" is checked
if "complexity" in to_data and "other" not in to_data["complexity"]:
to_data["complexity_other"] = ""
to_data["complexity_other"] = None
if "dev_team" in to_data and "other" not in to_data["dev_team"]:
to_data["dev_team_other"] = ""
to_data["dev_team_other"] = None
return to_data
@ -139,8 +139,8 @@ class UpdateTaskOrderWorkflow(ShowTaskOrderWorkflow):
if self.task_order:
if "portfolio_name" in self.form.data:
new_name = self.form.data["portfolio_name"]
old_name = self.task_order.to_dictionary()["portfolio_name"]
if not new_name is old_name:
old_name = self.task_order.portfolio_name
if not new_name == old_name:
Portfolios.update(self.task_order.portfolio, {"name": new_name})
TaskOrders.update(self.user, self.task_order, **self.task_order_form_data)
else:

View File

@ -165,13 +165,14 @@ def test_update_task_order_with_existing_task_order(task_order):
def test_other_text_not_saved_if_other_not_checked(task_order):
to_data = {
**TaskOrderFactory.dictionary(),
"complexity": ["conus", "other"],
"complexity": ["conus"],
"complexity_other": "quite complex",
}
workflow = UpdateTaskOrderWorkflow(
task_order.creator, to_data, task_order_id=task_order.id
)
workflow.update()
assert not workflow.task_order.complexity_other
def test_invite_officers_to_task_order(task_order, queue):