From fdd98a1575e11822bd22e3b704ae48b5e85528b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felipe=20Sodr=C3=A9?= Date: Sun, 17 Dec 2023 22:44:22 -0300 Subject: [PATCH] update test_occurrences_with_format_parameter to AsyncMock, add metadata Mock() :warning: not passing --- tests/test_occurrences_client.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/tests/test_occurrences_client.py b/tests/test_occurrences_client.py index 3fc43b7..1c0a59c 100644 --- a/tests/test_occurrences_client.py +++ b/tests/test_occurrences_client.py @@ -1,5 +1,5 @@ import datetime -from unittest.mock import Mock +from unittest.mock import AsyncMock, Mock from geopandas import GeoDataFrame from pandas import DataFrame @@ -135,10 +135,14 @@ async def test_occurrences_without_victims(occurrences_client_and_get_mock): ) -def test_occurrences_with_format_parameter(): - client_mock = Mock() +@mark.asyncio +async def test_occurrences_with_format_parameter(): + client_mock = AsyncMock() + metadata_mock = Mock() + metadata_mock.json.return_value = {"pageMeta": {"pageCount": 1}} + client_mock.get.return_value = ("occs", metadata_mock) occurrences = Occurrences(client_mock, id_state=42, format="df") - occurrences() + await occurrences() occurrences.client.get.assert_called_once_with( "http://127.0.0.1/api/v2/occurrences?idState=42&typeOccurrence=withVictim&page=1", format="df",