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-28438: Extending deployment's filtering #94

Merged
merged 1 commit into from
Aug 30, 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: 2 additions & 0 deletions connect_ext_ppr/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,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