"""Functional tests for fetching transactions.""" from oto import status import pytest from tests.testutils import db @db.test_schema_default_seed @pytest.mark.parametrize( "params, expected", [ ( { "report_run_id": 1, }, { "total_count": 1, "non_zero_count": 1, "currency_agnostic_total": 9001, "completed_date": "2020-02-03T04:05:06Z", }, ), ( { "report_run_id": 1, "collaborator_dp_enabled": True, }, { "total_count": 1, "non_zero_count": 1, "currency_agnostic_total": 9001, "completed_date": "2020-02-03T04:05:06Z", }, ), ( { "report_run_id": 1, "collaborator_dp_enabled": False, }, { "total_count": 3, "non_zero_count": 3, "currency_agnostic_total": 19236, "completed_date": "2020-02-03T04:05:06Z", }, ), ( { "report_run_id": 120594, "collaborator_dp_enabled": False, }, { "total_count": 0, "non_zero_count": 0, "currency_agnostic_total": 0, "completed_date": None, }, ), ], ) def test_get_transactions(params, expected, auth_client): """Test get transactions aggregations handler.""" result = auth_client.get( "/transactions/aggregations", query_string=params, ) assert result.status_code == status.OK assert result.json == expected