Skip to content

Instantly share code, notes, and snippets.

@mfurquimdev
Created November 25, 2021 18:14
Show Gist options
  • Save mfurquimdev/8e42e5087b6a6ad0d4e0673a01cdb83b to your computer and use it in GitHub Desktop.
Save mfurquimdev/8e42e5087b6a6ad0d4e0673a01cdb83b to your computer and use it in GitHub Desktop.

Revisions

  1. mfurquimdev created this gist Nov 25, 2021.
    27 changes: 27 additions & 0 deletions parametrize.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,27 @@
    @pytest.mark.asyncio
    @pytest.mark.parametrize(
    "request_body",
    [
    {
    "start_date": "2021-02-01 00:00:00",
    "sensors": [],
    },
    {"start_date": "2021-02-01 00:00:00", "end_date": "2021-02-01 00:30:00"},
    ],
    )
    async def test_recalculation_missing_input_parameters(
    request_body, async_client, monkeypatch
    ):
    def build_run_workflow_mock(*args, **kwargs):
    class TaskMock:
    id = "id1"

    return TaskMock()

    monkeypatch.setattr(
    "app.disaggregation.view.build_run_workflow", build_run_workflow_mock
    )

    log.info(f'request_body = {request_body}')
    response = await async_client.post("/recalculation", json=request_body)
    assert response.status_code == 422