From 2c285f70232ae68ce021bb801cccef28ee4a1aeb Mon Sep 17 00:00:00 2001 From: Arthur Deierlein Date: Tue, 18 Jun 2024 13:58:17 +0200 Subject: [PATCH] chore(backend): added failing test for task statistics --- .../reports/tests/test_task_statistic.py | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/backend/timed/reports/tests/test_task_statistic.py b/backend/timed/reports/tests/test_task_statistic.py index 92de5a0d4..ab6baca7a 100644 --- a/backend/timed/reports/tests/test_task_statistic.py +++ b/backend/timed/reports/tests/test_task_statistic.py @@ -138,3 +138,37 @@ def test_task_statistic_filtered( json = result.json() assert json["meta"]["total-time"] == f"{expected_result:02}:00:00" + + +def test_task_statistics_broken( + auth_client, + setup_customer_and_employment_status, + report_factory, + task, +): + user = auth_client.user + setup_customer_and_employment_status( + user=user, + is_assignee=True, + is_customer=True, + is_employed=True, + is_external=False, + ) + + report_factory.create(duration=timedelta(hours=2), date="2022-08-05", task=task) + report_factory.create(duration=timedelta(hours=2), date="2022-08-06", task=task) + report_factory.create(duration=timedelta(hours=2), date="2022-08-07", task=task) + + the_filter = { + "from_date": "2022-08-02", + "to_date": "2022-08-06", + } + url = reverse("task-statistic-list") + result = auth_client.get( + url, + data={"ordering": "name", "include": "project,project.customer", **the_filter}, + ) + assert result.status_code == status.HTTP_200_OK + + json = result.json() + assert json["meta"]["total-time"] == "04:00:00"