Skip to content

Commit

Permalink
Update some tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mgcth committed Mar 30, 2024
1 parent 59ae528 commit 81dc1e0
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions src/smhi/metfcts.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@

from smhi.constants import METFCTS_PARAMETER_DESCRIPTIONS, METFCTS_URL
from smhi.mesan import Mesan
from smhi.models.metfcts import (
from smhi.models.metfcts_model import (
MetfctsApprovedTime,
MetfctsMultiPointData,
MetfctsParameters,
MetfctsPointData,
MetfctsPolygon,
MetfctsValidTime,
)
from smhi.models.variable import (
from smhi.models.variable_model import (
ApprovedTime,
MultiPointData,
Parameters,
Expand Down
4 changes: 2 additions & 2 deletions src/smhi/models/variable_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

from typing import TypeVar

from smhi.models.mesan import (
from smhi.models.mesan_model import (
MesanApprovedTime,
MesanMultiPointData,
MesanParameters,
MesanPointData,
MesanPolygon,
MesanValidTime,
)
from smhi.models.metfcts import (
from smhi.models.metfcts_model import (
MetfctsApprovedTime,
MetfctsMultiPointData,
MetfctsParameters,
Expand Down
File renamed without changes.
12 changes: 6 additions & 6 deletions tests/unit/test_unit_metobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ def test_unit_basemetobs_init(self):
assert base.summary is None
assert base.link is None

@patch("smhi.metobs.requests.get", return_value=MockResponse(200, None, None))
@patch("smhi.utils.requests.get", return_value=MockResponse(200, None, None))
def test_unit_basemetobs_get_and_parse_request(self, mock_requests_get):
"""Unit test for BaseMetobs _get_and_parse_request method.
Expand Down Expand Up @@ -346,7 +346,7 @@ class TestUnitVersions:
"""Unit tests for Versionss class."""

@pytest.mark.parametrize("data_type", [("json"), ("yaml"), ("xml"), (None)])
@patch("smhi.metobs.requests.get")
@patch("smhi.utils.requests.get")
def test_unit_versions_init(self, mock_requests_get, data_type, setup_versions):
"""Unit test for Parameters init method.
Expand Down Expand Up @@ -391,7 +391,7 @@ class TestUnitParameters:
],
)
@patch("smhi.metobs.Versions")
@patch("smhi.metobs.requests.get")
@patch("smhi.utils.requests.get")
def test_unit_parameters_init(
self,
mock_requests_get,
Expand Down Expand Up @@ -451,7 +451,7 @@ class TestUnitStations:
("1", "Lufttemperatur", None),
],
)
@patch("smhi.metobs.requests.get")
@patch("smhi.utils.requests.get")
def test_unit_stations_init(
self,
mock_requests_get,
Expand Down Expand Up @@ -516,7 +516,7 @@ class TestUnitPeriods:
(1, "Akalla", "all", "json"),
],
)
@patch("smhi.metobs.requests.get")
@patch("smhi.utils.requests.get")
def test_unit_periods_init(
self,
mock_requests_get,
Expand Down Expand Up @@ -595,7 +595,7 @@ class TestUnitData:
("corrected-archive", "json"),
],
)
@patch("smhi.metobs.requests.get")
@patch("smhi.utils.requests.get")
def test_unit_data_init(
self,
mock_requests_get,
Expand Down
8 changes: 4 additions & 4 deletions tests/unit/test_unit_strang.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
STRANG_PARAMETERS,
STRANG_POINT_URL,
)
from smhi.models.strang import StrangParameter
from smhi.models.strang_model import StrangParameter
from smhi.strang import Strang

INPUT_DAILY_2020_01_01_2020_01_02 = [
Expand Down Expand Up @@ -410,11 +410,11 @@ def test_unit_strang_build_time_multipoint_url(self, time_interval, expected_url
@patch("smhi.strang.Strang._parse_point_data")
@patch("smhi.strang.logging.info")
@patch(
"smhi.strang.requests.get",
"smhi.utils.requests.get",
return_value=type(
"MyClass",
(object,),
{"status": True, "headers": "header", "content": "content"},
{"status_code": 200, "headers": "header", "content": "content"},
)(),
)
@patch(
Expand Down Expand Up @@ -447,7 +447,7 @@ def test_unit_strang_get_and_load_data(
mock_requests_get.return_value.status_code = status_expected

data, headers, status = client._get_and_load_data(client.url, "parameter")
mock_requests_get.assert_called_once_with(client.url)
mock_requests_get.assert_called_once_with(client.url, timeout=200)

if status == 200:
mock_json_loads.assert_called_once_with(
Expand Down

0 comments on commit 81dc1e0

Please sign in to comment.