Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

LITE-28850 Fix ppr marketplace validation #123

Merged
merged 1 commit into from
Oct 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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:
jonatrios marked this conversation as resolved.
Show resolved Hide resolved
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