Skip to content

Commit

Permalink
LITE-28850 Fix PPR marketplaces validation
Browse files Browse the repository at this point in the history
  • Loading branch information
Hairash committed Oct 13, 2023
1 parent e6fed9c commit 59771de
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion connect_ext_ppr/validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def validate_marketplaces_ppr(ppr, dr_marketplaces, dep_marketplaces):
mkplcs_w_erros = []
for mp_data in dr_marketplaces:
mp_id = mp_data.id
if dep_mkplc_map[mp_id].ppr_id and dep_mkplc_map[mp_id].ppr_id > ppr.id:
if dep_mkplc_map[mp_id].ppr_id and dep_mkplc_map[mp_id].ppr.version > ppr.version:
mkplcs_w_erros.append(mp_id)

if mkplcs_w_erros:
Expand Down
10 changes: 5 additions & 5 deletions tests/api/test_deployment_requests.py
Original file line number Diff line number Diff line change
Expand Up @@ -894,12 +894,12 @@ def test_create_deployment_invalid_ppr_for_marketplace(
mocker.patch('connect_ext_ppr.webapp.get_client_object', side_effect=[hub_data])

dep = deployment_factory(account_id=installation['owner']['id'], hub_id=hub_data['id'])
ppr = ppr_version_factory(deployment=dep, version=1, id='PPRFL-123')
ppr_file = file_factory(id='FL-123')
ppr = ppr_version_factory(deployment=dep, version=1, id='PPRFL-125')
ppr_file = file_factory(id='FL-125')
ppr2 = ppr_version_factory(deployment=dep, version=2, id='PPRFL-124', file=ppr_file.id)

marketplace_config_factory(deployment=dep, marketplace_id='MP-124')
marketplace_config_factory(deployment=dep, marketplace_id='MP-123', ppr_id=ppr2.id)
marketplace_config_factory(deployment=dep, marketplace_id='MP-125', ppr_id=ppr2.id)
marketplace_config_factory(deployment=dep, marketplace_id='MP-126', ppr_id=ppr.id)

body = {
Expand All @@ -908,7 +908,7 @@ def test_create_deployment_invalid_ppr_for_marketplace(
'manually': True,
'delegate_l2': True,
'marketplaces': [
{'id': 'MP-123'},
{'id': 'MP-125'},
{'id': 'MP-126'},
{'id': 'MP-124'},
],
Expand All @@ -922,7 +922,7 @@ def test_create_deployment_invalid_ppr_for_marketplace(
assert response.status_code == 400
assert response.json()['error_code'] == 'VAL_004', response.json()
assert response.json()['errors'] == [
'Cannot applied PPR to marketplaces [\'MP-123\'].',
'Cannot applied PPR to marketplaces [\'MP-125\'].',
]


Expand Down

0 comments on commit 59771de

Please sign in to comment.