Skip to content

Commit

Permalink
Merge pull request #80 from cloudblue/bug/LITE-28329-Creating-DR-with…
Browse files Browse the repository at this point in the history
…-no-choices-in-post-body-generates-an-exception

LITE-28329: Handling the case of not choice available on POST DR body
  • Loading branch information
d3rky authored Aug 7, 2023
2 parents 3c77cf7 + 80c3eee commit 19c6b55
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion connect_ext_ppr/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class PrimaryKeyReference(BaseModel):


class ChoicesSchema(BaseModel):
choices: Optional[List[PrimaryKeyReference]]
choices: Optional[List[PrimaryKeyReference]] = []
all: bool

@root_validator
Expand Down
13 changes: 9 additions & 4 deletions tests/api/test_deployment_requests.py
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,13 @@ def test_create_deployment_request_without_delegation_to_l2(
assert tasks[1].type == Task.TYPES.apply_and_delegate


@pytest.mark.parametrize(
'marketplaces_dict',
(
{'choices': [], 'all': True},
{'all': True},
),
)
def test_create_deployment_request_with_all_marketplaces(
mocker,
dbsession,
Expand All @@ -392,6 +399,7 @@ def test_create_deployment_request_with_all_marketplaces(
ppr_version_factory,
installation,
api_client,
marketplaces_dict,
):
hub_data = {
'id': 'HB-0000-0001',
Expand All @@ -409,10 +417,7 @@ def test_create_deployment_request_with_all_marketplaces(
'deployment': {'id': dep.id},
'ppr': {'id': ppr.id},
'manually': True,
'marketplaces': {
'choices': [],
'all': True,
},
'marketplaces': marketplaces_dict,
}
response = api_client.post(
'/api/deployments/requests',
Expand Down

0 comments on commit 19c6b55

Please sign in to comment.