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

Verify compatibility between WorkflowTaskV2.type_filters and TaskV2.input_types #2196

Prev Previous commit
Next Next commit
test import endpoint
  • Loading branch information
ychiucco committed Jan 21, 2025
commit 95f5c0fb7804fd01346fa91888d74448ea6a3b18
38 changes: 38 additions & 0 deletions tests/v2/03_api/test_api_workflow_import_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -613,3 +613,41 @@ async def test_import_with_legacy_filters(
assert "Cannot set attribute filters for WorkflowTasks." in str(
res.json()
)


async def test_import_filters_compatibility(
MockCurrentUser,
project_factory_v2,
task_factory_v2,
client,
):
async with MockCurrentUser() as user:
prj = await project_factory_v2(user)
await task_factory_v2(
user_id=user.id,
source="foo",
input_types={"a": True, "b": False},
)

res = await client.post(
f"{PREFIX}/project/{prj.id}/workflow/import/",
json=dict(
name="Workflow Ok",
task_list=[
{"task": {"source": "foo"}, "type_filters": {"a": True}}
],
),
)
assert res.status_code == 201

res = await client.post(
f"{PREFIX}/project/{prj.id}/workflow/import/",
json=dict(
name="Workflow Fail",
task_list=[
{"task": {"source": "foo"}, "type_filters": {"b": True}}
],
),
)
assert res.status_code == 422
assert "filters" in res.json()["detail"]