Skip to content

Commit 1c0edfa

Browse files
committed
feat(lab-3897): generate cuid for step creation
1 parent dfd07bc commit 1c0edfa

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/kili/adapters/kili_api_gateway/project_workflow/mappers.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
from typing import Dict, Union
44

5+
from cuid import cuid
6+
57
from kili.domain.project import WorkflowStepCreate, WorkflowStepUpdate
68

79
from .types import ProjectWorkflowDataKiliAPIGatewayInput
@@ -26,7 +28,7 @@ def project_input_mapper(data: ProjectWorkflowDataKiliAPIGatewayInput) -> Dict:
2628
def update_step_mapper(data: Union[WorkflowStepCreate, WorkflowStepUpdate]) -> Dict:
2729
"""Build the GraphQL create StepData variable to be sent in an operation."""
2830
step = {
29-
"id": data["id"] if "id" in data else None,
31+
"id": data["id"] if "id" in data else cuid(),
3032
"name": data["name"] if "name" in data else None,
3133
"consensusCoverage": data["consensus_coverage"] if "consensus_coverage" in data else None,
3234
"numberOfExpectedLabelsForConsensus": data["number_of_expected_labels_for_consensus"]

tests/integration/presentation/test_project_workflow.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def test_when_updating_project_workflow_then_it_returns_updated_project_workflow
2323

2424
# Then
2525
kili.kili_api_gateway.graphql_client.execute.assert_called_once_with(
26-
get_update_project_workflow_mutation(" enforceStepSeparation"),
26+
get_update_project_workflow_mutation(" enforceStepSeparation steps{id}"),
2727
{
2828
"input": {
2929
"projectId": "fake_proj_id",

0 commit comments

Comments
 (0)