Skip to content

Commit a8d8d93

Browse files
committed
Don't mock the internals of the microgrid client
Since we are now using an external microgrid client, it is better to mock the location more shallowly, avoiding any timezone lookups completely. Signed-off-by: Leandro Lucarella <[email protected]>
1 parent 2faa6f6 commit a8d8d93

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

tests/microgrid/test_microgrid_api.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"""Tests of MicrogridApi."""
55

66
import asyncio
7+
import zoneinfo
78
from asyncio.tasks import ALL_COMPLETED
89
from unittest import mock
910
from unittest.mock import AsyncMock, MagicMock
@@ -94,13 +95,13 @@ def metadata(self) -> Metadata:
9495
Returns:
9596
the microgrid metadata.
9697
"""
97-
mock_timezone_finder = MagicMock()
98-
mock_timezone_finder.timezone_at.return_value = "Europe/Berlin"
99-
meta._timezone_finder = mock_timezone_finder # pylint: disable=protected-access
100-
10198
return Metadata(
10299
microgrid_id=8,
103-
location=meta.Location(latitude=52.520008, longitude=13.404954),
100+
location=Location(
101+
latitude=52.520008,
102+
longitude=13.404954,
103+
timezone=zoneinfo.ZoneInfo("Europe/Berlin"),
104+
),
104105
)
105106

106107
@mock.patch("grpc.aio.insecure_channel")

0 commit comments

Comments
 (0)