🐛 fix(flow.py): make flow field optional to allow creation of flows without a flow

🧪 test(test_database.py): add test case for creating flows without a flow
The flow field is now optional to allow creation of flows without a flow. This is useful when creating a flow that will be populated later. A test case was added to ensure that flows can be created without a flow.
This commit is contained in:
Gabriel Luiz Freitas Almeida 2023-06-06 17:37:05 -03:00
commit 2feeeb9ecd
2 changed files with 9 additions and 1 deletions

View file

@ -38,6 +38,12 @@ def test_create_flow(client: TestClient, json_flow: str):
assert response.status_code == 200
assert response.json()["name"] == flow.name
assert response.json()["flow"] == flow.flow
# flow is optional so we can create a flow without a flow
flow = FlowCreate(name="Test Flow")
response = client.post("api/v1/flows/", json=flow.dict(exclude_unset=True))
assert response.status_code == 200
assert response.json()["name"] == flow.name
assert response.json()["flow"] == flow.flow
def test_read_flows(client: TestClient, json_flow: str):