Skip to content

Commit c396915

Browse files
author
Dana Stiefel
committed
code rabbit fixes
1 parent 03d6657 commit c396915

3 files changed

Lines changed: 27 additions & 2 deletions

File tree

backend/compact-connect/lambdas/python/compact-configuration/tests/function/test_compact_configuration.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -320,8 +320,8 @@ def test_get_public_live_compact_jurisdictions_returns_400_if_bad_compact_param(
320320
self.assertEqual(400, response['statusCode'], msg=json.loads(response['body']))
321321
response_body = json.loads(response['body'])
322322

323-
# Verify the live jurisdictions
324-
self.assertCountEqual({'message': 'Invalid request query param: invalid_compact'}, response_body)
323+
# Verify the error message
324+
self.assertEqual({'message': 'Invalid request query param: invalid_compact'}, response_body)
325325

326326

327327
@mock_aws

backend/compact-connect/stacks/api_stack/v1_api/api_model.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2360,6 +2360,30 @@ def public_provider_response_model(self) -> Model:
23602360
)
23612361
return self.api._v1_public_provider_response_model
23622362

2363+
@property
2364+
def get_live_jurisdiction_model(self) -> Model:
2365+
"""Return the get live jurisdiction response model, which should only be created once per API"""
2366+
if hasattr(self.api, '_v1_get_live_jurisdiction_response_model'):
2367+
return self.api._v1_get_live_jurisdiction_response_model
2368+
2369+
# Shape: { "<compact>": ["ky", "oh", ...], ... }
2370+
# Keys are dynamic compact abbreviations; values are arrays of jurisdiction abbreviations
2371+
self.api._v1_get_live_jurisdiction_response_model = self.api.add_model(
2372+
'V1GetLiveJurisdictionsResponseModel',
2373+
description='Dictionary keyed by compact abbreviations with arrays of live jurisdiction abbreviations',
2374+
schema=JsonSchema(
2375+
type=JsonSchemaType.OBJECT,
2376+
additional_properties=JsonSchema(
2377+
type=JsonSchemaType.ARRAY,
2378+
items=JsonSchema(
2379+
type=JsonSchemaType.STRING,
2380+
enum=self.api.node.get_context('jurisdictions'),
2381+
),
2382+
),
2383+
),
2384+
)
2385+
return self.api._v1_get_live_jurisdiction_response_model
2386+
23632387
@property
23642388
def _public_provider_detailed_response_schema(self):
23652389
"""Schema for public provider responses based on ProviderPublicResponseSchema"""

backend/compact-connect/stacks/api_stack/v1_api/compact_configuration_api.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ def _add_get_live_jurisdictions_endpoint(self, compact_configuration_api_handler
138138
method_responses=[
139139
MethodResponse(
140140
status_code='200',
141+
response_models={'application/json': self.api_model.get_live_jurisdiction_model},
141142
),
142143
],
143144
request_parameters={

0 commit comments

Comments
 (0)