Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update TaskWorkflowTemplate.create_task_workflow() method and unit test #1339

Merged

Conversation

dalecannon
Copy link
Contributor

Update TaskWorkflowTemplate.create_task_workflow() method

Why

The task-workflow megabranch has a failing test following changes to TaskWorkflow model: tasks/tests/test_workflow_models.py::test_create_task_workflow_from_task_workflow_template

What

  • Adds summary_data param to TaskWorkflowTemplate.create_task_workflow() to populate the details of the TaskWorkflow.summary_task instance (since it has become a required field), replacing the old way of using the workflow template's title and description
  • Updates unit test based on the above change
  • Fixes application of tasks/migrations/0012_taskworkflow_assign_summary_task.py by saving the modified object instances in the forward migration operation

Checklist

  • Requires migrations? Yes
  • Requires dependency updates? No

@dalecannon dalecannon requested a review from a team as a code owner November 26, 2024 11:56
def create_task_workflow(self) -> "TaskWorkflow":
"""Create a workflow and it subtasks, using values from this template
workflow and its task templates."""
def create_task_workflow(self, summary_data: dict) -> "TaskWorkflow":
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might it be preferable, better documenting this API, to be explicit stating which fields are required or expected to create a TaskWorkflow, with TaskWorkflow.summary_task being kept as an internal detail?

Suggested change
def create_task_workflow(self, summary_data: dict) -> "TaskWorkflow":
def create_task_workflow(self, title: str, description: str) -> "TaskWorkflow":

@dalecannon dalecannon merged commit 997d36a into TP2000-1471--task-workflow Nov 28, 2024
@dalecannon dalecannon deleted the fix-task-workflow-megabranch-test branch November 28, 2024 12:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants