36
36
GetOperationsResponse ,
37
37
GetStatusRequest ,
38
38
GetStatusResponse ,
39
+ GetMachineStatusRequest ,
40
+ GetMachineStatusResponse ,
41
+ ResourceStatus ,
39
42
GetVersionRequest ,
40
43
GetVersionResponse ,
41
44
Operation ,
161
164
api_version = "0.3.0" ,
162
165
)
163
166
167
+ GET_MACHINE_STATUS_RESPONSE = GetMachineStatusResponse (
168
+ resources = [
169
+ ResourceStatus (
170
+ name = ResourceName (namespace = RESOURCE_NAMESPACE_RDK , type = RESOURCE_TYPE_COMPONENT , subtype = "arm" , name = "arm1" ),
171
+ state = ResourceStatus .State .STATE_READY ,
172
+ )
173
+ ]
174
+ )
175
+
164
176
165
177
@pytest .fixture (scope = "function" )
166
178
def service () -> RobotService :
@@ -225,6 +237,11 @@ async def GetVersion(stream: Stream[GetVersionRequest, GetVersionResponse]) -> N
225
237
assert request is not None
226
238
await stream .send_message (GET_VERVSION_RESPONSE )
227
239
240
+ async def GetMachineStatus (stream : Stream [GetMachineStatusRequest , GetMachineStatusResponse ]) -> None :
241
+ request = await stream .recv_message ()
242
+ assert request is not None
243
+ await stream .send_message (GET_MACHINE_STATUS_RESPONSE )
244
+
228
245
async def Shutdown (stream : Stream [ShutdownRequest , ShutdownResponse ]) -> None :
229
246
request = await stream .recv_message ()
230
247
assert request is not None
@@ -240,6 +257,7 @@ async def Shutdown(stream: Stream[ShutdownRequest, ShutdownResponse]) -> None:
240
257
service .GetCloudMetadata = GetCloudMetadata
241
258
service .Shutdown = Shutdown
242
259
service .GetVersion = GetVersion
260
+ service .GetMachineStatus = GetMachineStatus
243
261
244
262
return service
245
263
@@ -462,6 +480,14 @@ async def test_get_version(self, service: RobotService):
462
480
assert md == GET_VERVSION_RESPONSE
463
481
await client .close ()
464
482
483
+ @pytest .mark .asyncio
484
+ async def test_get_machine_status (self , service : RobotService ):
485
+ async with ChannelFor ([service ]) as channel :
486
+ client = await RobotClient .with_channel (channel , RobotClient .Options ())
487
+ statuses = await client .get_machine_status ()
488
+ assert statuses == GET_MACHINE_STATUS_RESPONSE
489
+ await client .close ()
490
+
465
491
@pytest .mark .asyncio
466
492
async def test_get_operations (self , service : RobotService ):
467
493
async with ChannelFor ([service ]) as channel :
0 commit comments