File tree Expand file tree Collapse file tree
tests/client_test_cases/list_microgrid_electrical_components Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ # License: MIT
2+ # Copyright © 2026 Frequenz Energy-as-a-Service GmbH
3+
4+ """Test data for successful electrical component listing."""
5+
6+ from typing import Any
7+
8+ from frequenz .api .assets .v1 import assets_pb2
9+ from frequenz .api .common .v1alpha8 .microgrid .electrical_components import (
10+ electrical_components_pb2 ,
11+ )
12+ from frequenz .client .common .microgrid import MicrogridId
13+ from frequenz .client .common .microgrid .electrical_components import ElectricalComponentId
14+
15+ from frequenz .client .assets .electrical_component import SteamBoiler
16+
17+
18+ def assert_stub_method_call (stub_method : Any ) -> None :
19+ """Assert that the gRPC request matches the expected request."""
20+ stub_method .assert_called_once_with (
21+ assets_pb2 .ListMicrogridElectricalComponentsRequest (microgrid_id = 1234 ),
22+ timeout = 60.0 ,
23+ )
24+
25+
26+ client_args = (1234 ,)
27+ grpc_response = assets_pb2 .ListMicrogridElectricalComponentsResponse (
28+ components = [
29+ electrical_components_pb2 .ElectricalComponent (
30+ id = 1 ,
31+ microgrid_id = 1234 ,
32+ category = electrical_components_pb2 .ELECTRICAL_COMPONENT_CATEGORY_STEAM_BOILER ,
33+ name = "Steam Boiler" ,
34+ )
35+ ]
36+ )
37+
38+
39+ def assert_client_result (result : Any ) -> None :
40+ """Assert that the client result matches the expected component list."""
41+ assert list (result ) == [
42+ SteamBoiler (
43+ id = ElectricalComponentId (1 ),
44+ microgrid_id = MicrogridId (1234 ),
45+ name = "Steam Boiler" ,
46+ manufacturer = None ,
47+ model_name = None ,
48+ )
49+ ]
You can’t perform that action at this time.
0 commit comments