From 7cbc2b4193131ded8d4efbadf6269c6263b1428d Mon Sep 17 00:00:00 2001 From: juuso-j Date: Wed, 13 Sep 2023 07:52:06 +0300 Subject: [PATCH] Test data_from_year field --- eco_counter/tests/test_api.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/eco_counter/tests/test_api.py b/eco_counter/tests/test_api.py index 8f0afc7bb..9e7fc2ce7 100644 --- a/eco_counter/tests/test_api.py +++ b/eco_counter/tests/test_api.py @@ -3,6 +3,7 @@ import pytest from rest_framework.reverse import reverse +from .conftest import TEST_TIMESTAMP from .constants import TEST_EC_STATION_NAME @@ -271,6 +272,7 @@ def test__station(api_client, stations, year_datas): assert response.status_code == 200 assert response.json()["results"][0]["name"] == TEST_EC_STATION_NAME assert response.json()["results"][0]["sensor_types"] == ["at"] + assert response.json()["results"][0]["data_from_year"] == TEST_TIMESTAMP.year # Test retrieving station by data type url = reverse("eco_counter:stations-list") + "?data_type=a" response = api_client.get(url)