update arg order for task order update utility class

This commit is contained in:
dandds 2019-01-09 16:16:18 -05:00
parent ccf1ff2024
commit 476627996e
2 changed files with 8 additions and 8 deletions

View File

@ -100,9 +100,9 @@ class ShowTaskOrderWorkflow:
class UpdateTaskOrderWorkflow(ShowTaskOrderWorkflow): class UpdateTaskOrderWorkflow(ShowTaskOrderWorkflow):
def __init__(self, form_data, user, screen=1, task_order_id=None): def __init__(self, user, form_data, screen=1, task_order_id=None):
self.form_data = form_data
self.user = user self.user = user
self.form_data = form_data
self.screen = screen self.screen = screen
self.task_order_id = task_order_id self.task_order_id = task_order_id
self._task_order = None self._task_order = None
@ -205,7 +205,7 @@ def new(screen, task_order_id=None):
@task_orders_bp.route("/task_orders/new/<int:screen>/<task_order_id>", methods=["POST"]) @task_orders_bp.route("/task_orders/new/<int:screen>/<task_order_id>", methods=["POST"])
def update(screen, task_order_id=None): def update(screen, task_order_id=None):
workflow = UpdateTaskOrderWorkflow( workflow = UpdateTaskOrderWorkflow(
http_request.form, g.current_user, screen, task_order_id g.current_user, http_request.form, screen, task_order_id
) )
if workflow.validate(): if workflow.validate():

View File

@ -141,7 +141,7 @@ def test_show_task_order_display_screen(task_order):
def test_update_task_order_with_no_task_order(): def test_update_task_order_with_no_task_order():
user = UserFactory.create() user = UserFactory.create()
to_data = TaskOrderFactory.dictionary() to_data = TaskOrderFactory.dictionary()
workflow = UpdateTaskOrderWorkflow(to_data, user) workflow = UpdateTaskOrderWorkflow(user, to_data)
assert workflow.task_order is None assert workflow.task_order is None
workflow.update() workflow.update()
assert workflow.task_order assert workflow.task_order
@ -151,7 +151,7 @@ def test_update_task_order_with_no_task_order():
def test_update_task_order_with_existing_task_order(task_order): def test_update_task_order_with_existing_task_order(task_order):
to_data = serialize_dates(TaskOrderFactory.dictionary()) to_data = serialize_dates(TaskOrderFactory.dictionary())
workflow = UpdateTaskOrderWorkflow( workflow = UpdateTaskOrderWorkflow(
to_data, task_order.creator, screen=2, task_order_id=task_order.id task_order.creator, to_data, screen=2, task_order_id=task_order.id
) )
assert workflow.task_order.start_date != to_data["start_date"] assert workflow.task_order.start_date != to_data["start_date"]
workflow.update() workflow.update()
@ -166,7 +166,7 @@ def test_invite_officers_to_task_order(task_order, queue):
"so_invite": True, "so_invite": True,
} }
workflow = UpdateTaskOrderWorkflow( workflow = UpdateTaskOrderWorkflow(
to_data, task_order.creator, screen=3, task_order_id=task_order.id task_order.creator, to_data, screen=3, task_order_id=task_order.id
) )
workflow.update() workflow.update()
workspace = task_order.workspace workspace = task_order.workspace
@ -191,7 +191,7 @@ def test_add_officer_but_do_not_invite(task_order, queue):
"so_invite": False, "so_invite": False,
} }
workflow = UpdateTaskOrderWorkflow( workflow = UpdateTaskOrderWorkflow(
to_data, task_order.creator, screen=3, task_order_id=task_order.id task_order.creator, to_data, screen=3, task_order_id=task_order.id
) )
workflow.update() workflow.update()
workspace = task_order.workspace workspace = task_order.workspace
@ -214,7 +214,7 @@ def test_update_does_not_resend_invitation():
) )
to_data = {**task_order.to_dictionary(), "ko_invite": True} to_data = {**task_order.to_dictionary(), "ko_invite": True}
workflow = UpdateTaskOrderWorkflow( workflow = UpdateTaskOrderWorkflow(
to_data, user, screen=3, task_order_id=task_order.id user, to_data, screen=3, task_order_id=task_order.id
) )
for i in range(2): for i in range(2):
workflow.update() workflow.update()