|
29 | 29 | FrameSystemConfig, |
30 | 30 | FrameSystemConfigRequest, |
31 | 31 | FrameSystemConfigResponse, |
| 32 | + GetCloudMetadataRequest, |
| 33 | + GetCloudMetadataResponse, |
32 | 34 | GetOperationsRequest, |
33 | 35 | GetOperationsResponse, |
34 | 36 | GetStatusRequest, |
|
140 | 142 |
|
141 | 143 | OPERATIONS_RESPONSE = [Operation(id=OPERATION_ID)] |
142 | 144 |
|
| 145 | +GET_CLOUD_METADATA_RESPONSE = GetCloudMetadataResponse( |
| 146 | + robot_part_id="the-robot-part", |
| 147 | + primary_org_id="the-primary-org", |
| 148 | + location_id="the-location", |
| 149 | +) |
| 150 | + |
143 | 151 |
|
144 | 152 | @pytest.fixture(scope="function") |
145 | 153 | def service() -> RobotService: |
@@ -194,12 +202,18 @@ async def GetOperations(stream: Stream[GetOperationsRequest, GetOperationsRespon |
194 | 202 | response = GetOperationsResponse(operations=OPERATIONS_RESPONSE) |
195 | 203 | await stream.send_message(response) |
196 | 204 |
|
| 205 | + async def GetCloudMetadata(stream: Stream[GetCloudMetadataRequest, GetCloudMetadataResponse]) -> None: |
| 206 | + request = await stream.recv_message() |
| 207 | + assert request is not None |
| 208 | + await stream.send_message(GET_CLOUD_METADATA_RESPONSE) |
| 209 | + |
197 | 210 | manager = ResourceManager(resources) |
198 | 211 | service = RobotService(manager) |
199 | 212 | service.FrameSystemConfig = Config |
200 | 213 | service.TransformPose = TransformPose |
201 | 214 | service.DiscoverComponents = DiscoverComponents |
202 | 215 | service.GetOperations = GetOperations |
| 216 | + service.GetCloudMetadata = GetCloudMetadata |
203 | 217 |
|
204 | 218 | return service |
205 | 219 |
|
@@ -407,6 +421,14 @@ async def test_discover_components(self, service: RobotService): |
407 | 421 | assert discoveries == DISCOVERY_RESPONSE |
408 | 422 | await client.close() |
409 | 423 |
|
| 424 | + @pytest.mark.asyncio |
| 425 | + async def test_get_cloud_metadata(self, service: RobotService): |
| 426 | + async with ChannelFor([service]) as channel: |
| 427 | + client = await RobotClient.with_channel(channel, RobotClient.Options()) |
| 428 | + md = await client.get_cloud_metadata() |
| 429 | + assert md == GET_CLOUD_METADATA_RESPONSE |
| 430 | + await client.close() |
| 431 | + |
410 | 432 | @pytest.mark.asyncio |
411 | 433 | async def test_get_operations(self, service: RobotService): |
412 | 434 | async with ChannelFor([service]) as channel: |
|
0 commit comments