Skip to content

Commit

Permalink
Merge pull request #94 from cloudblue/feature/LITE-28438-extending-de…
Browse files Browse the repository at this point in the history
…ployments-filtering

LITE-28438: Extending deployment's filtering
  • Loading branch information
d3rky authored Aug 30, 2023
2 parents 51d084c + 2fad1db commit 4af6a2d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions connect_ext_ppr/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
class DeploymentFilter(Filter):
hub_id: Optional[str]
product_id: Optional[str]
status: Optional[str]
vendor_id: Optional[str]

class Constants(Filter.Constants):
model = Deployment
Expand Down
5 changes: 5 additions & 0 deletions tests/api/test_deployments.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@ def test_get_deployments_empty(
('?product_id=PRD-XXX-XXX-XXX&hub_id=HB-0000-0001', 1),
('?product_id=PRD-YYY-YYY-YYY&hub_id=HB-0000-0000', 1),
('?product_id=PRD-YYY-YYY-YYY&hub_id=HB-0000-0001', 0),
('?vendor_id=VA-000-000', 2),
('?status=synced', 1),
),
)
def test_get_deployments_w_filter(
Expand All @@ -131,7 +133,9 @@ def test_get_deployments_w_filter(
deployment_factory(
account_id=installation['owner']['id'],
product_id='PRD-YYY-YYY-YYY',
vendor_id='VA-000-001',
hub_id='HB-0000-0000',
status='synced',
)
listing_data = {
'product': {
Expand Down Expand Up @@ -160,6 +164,7 @@ def test_get_deployments_w_filter(
}
listing_data2 = copy.deepcopy(listing_data)
listing_data2['product']['id'] = 'PRD-YYY-YYY-YYY'
listing_data2['vendor']['id'] = 'VA-000-001'
del listing_data2['contract']['marketplace']['hubs'][1]

mocker.patch(
Expand Down
2 changes: 2 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ def _build_deployment(
account_id='PA-000-000',
vendor_id='VA-000-000',
hub_id='HB-0000-0000',
status='pending',
):
product = product_factory(id=product_id, owner_id=vendor_id)
product_id = product.id
Expand All @@ -158,6 +159,7 @@ def _build_deployment(
account_id=account_id,
vendor_id=vendor_id,
hub_id=hub_id,
status=status,
)
dbsession.set_verbose(dep)
dbsession.commit()
Expand Down

0 comments on commit 4af6a2d

Please sign in to comment.