Skip to content
Snippets Groups Projects

Resolve "Workflow usage statistics"

Merged Daniel Göbel requested to merge feature/24-workflow-usage-statistics into development
2 files
+ 51
2
Compare changes
  • Side-by-side
  • Inline
Files
2
from datetime import date
from io import BytesIO
from uuid import UUID, uuid4
import pytest
from clowmdb.models import Workflow, WorkflowVersion
from clowmdb.models import Workflow, WorkflowExecution, WorkflowVersion
from fastapi import status
from httpx import AsyncClient
from sqlalchemy import delete, select
@@ -380,6 +381,34 @@ class TestWorkflowRoutesGet(_TestWorkflowRoutes):
)
assert response.status_code == status.HTTP_404_NOT_FOUND
@pytest.mark.asyncio
async def test_get_workflow_statistics(
self,
client: AsyncClient,
random_user: UserWithAuthHeader,
random_workflow: WorkflowOut,
random_workflow_execution: WorkflowExecution,
) -> None:
"""
Test for getting a non-existing workflow.
Parameters
----------
client : httpx.AsyncClient
HTTP Client to perform the request on. pytest fixture.
random_user : app.tests.utils.user.UserWithAuthHeader
Random user for testing. pytest fixture.
"""
response = await client.get(
"/".join([self.base_path, str(random_workflow.workflow_id), "statistics"]),
headers=random_user.auth_headers,
)
assert response.status_code == status.HTTP_200_OK
statistics = response.json()
assert len(statistics) == 1
assert statistics[0]["day"] == str(date.today())
assert statistics[0]["count"] == 1
class TestWorkflowRoutesDelete(_TestWorkflowRoutes):
@pytest.mark.asyncio
Loading