From c5ffaf1fff3c45e8dcf4679ed914fd7ebc7862f7 Mon Sep 17 00:00:00 2001 From: Johan Schreurs Date: Mon, 14 Nov 2022 09:54:15 +0100 Subject: [PATCH] Issue #78, code review, doing some small corrections first --- tests/conftest.py | 6 ++---- tests/test_backend.py | 7 +++---- tests/test_views.py | 1 - 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index 2cd61654..ea0e30af 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -13,7 +13,7 @@ @pytest.fixture -def backend1(requests_mock,) -> str: +def backend1(requests_mock) -> str: domain = "https://b1.test/v1" # TODO: how to work with different API versions? requests_mock.get(domain + "/", json={"api_version": "1.0.0"}) @@ -34,9 +34,7 @@ def backend2(requests_mock) -> str: # as "lib_requests_mock": make a distinction with the pytest fixture that has the same name -import requests_mock as lib_requests_mock - -def set_backend_to_api_version(requests_mock: lib_requests_mock.Mocker, domain: str, api_version: str) -> str: +def set_backend_to_api_version(requests_mock, domain: str, api_version: str) -> str: """Helper function to make the backend connection use the expected API version.""" # TODO: would like a nicer solution to make the backend fixtures match the expected API version. diff --git a/tests/test_backend.py b/tests/test_backend.py index d261b336..2e08fede 100644 --- a/tests/test_backend.py +++ b/tests/test_backend.py @@ -1,5 +1,4 @@ -from sys import implementation -from datetime import datetime +import datetime as dt import pytest @@ -215,7 +214,7 @@ def service_metadata_wmts_foo(self): configuration={"version": "0.5.8"}, attributes={}, title="Test WMTS service", - created=datetime(2020, 4, 9, 15, 5, 8) + created=dt.datetime(2020, 4, 9, 15, 5, 8) ) @pytest.fixture @@ -229,7 +228,7 @@ def service_metadata_wms_bar(self): configuration={"version": "0.5.8"}, attributes={}, title="Test WMS service", - created=datetime(2022, 2, 1, 13, 30, 3) + created=dt.datetime(2022, 2, 1, 13, 30, 3) ) def test_list_services_simple( diff --git a/tests/test_views.py b/tests/test_views.py index cf47b6d8..91ecf741 100644 --- a/tests/test_views.py +++ b/tests/test_views.py @@ -1,5 +1,4 @@ import logging -import logging import re from typing import Tuple, List