mirror of
https://github.com/quay/quay.git
synced 2025-07-14 05:01:08 +03:00
billing: marketplace UI (PROJQUAY-6551) (#2595)
* billing: marketplace UI adds UI in billing section for managing user and org-bound skus add more unit tests for org binding changed endpoint for bulk attaching skus to orgs
This commit is contained in:
@ -37,9 +37,11 @@ from endpoints.api.billing import (
|
||||
OrganizationCard,
|
||||
OrganizationPlan,
|
||||
OrganizationRhSku,
|
||||
OrganizationRhSkuBatchRemoval,
|
||||
OrganizationRhSkuSubscriptionField,
|
||||
UserCard,
|
||||
UserPlan,
|
||||
UserSkuList,
|
||||
)
|
||||
from endpoints.api.build import (
|
||||
RepositoryBuildList,
|
||||
@ -5076,7 +5078,7 @@ class TestOrganizationRhSku(ApiTestCase):
|
||||
self.postResponse(
|
||||
resource_name=OrganizationRhSku,
|
||||
params=dict(orgname=SUBSCRIPTION_ORG),
|
||||
data={"subscription_id": 12345678},
|
||||
data={"subscriptions": [{"subscription_id": 12345678}]},
|
||||
expected_code=201,
|
||||
)
|
||||
json = self.getJsonResponse(
|
||||
@ -5093,7 +5095,7 @@ class TestOrganizationRhSku(ApiTestCase):
|
||||
self.postResponse(
|
||||
resource_name=OrganizationRhSku,
|
||||
params=dict(orgname=SUBSCRIPTION_ORG),
|
||||
data={"subscription_id": 12345678},
|
||||
data={"subscriptions": [{"subscription_id": 12345678}]},
|
||||
expected_code=400,
|
||||
)
|
||||
|
||||
@ -5103,7 +5105,7 @@ class TestOrganizationRhSku(ApiTestCase):
|
||||
self.postResponse(
|
||||
resource_name=OrganizationRhSku,
|
||||
params=dict(orgname=SUBSCRIPTION_ORG),
|
||||
data={"subscription_id": 11111111},
|
||||
data={"subscriptions": [{"subscription_id": 11111}]},
|
||||
expected_code=401,
|
||||
)
|
||||
|
||||
@ -5112,7 +5114,7 @@ class TestOrganizationRhSku(ApiTestCase):
|
||||
self.postResponse(
|
||||
resource_name=OrganizationRhSku,
|
||||
params=dict(orgname=SUBSCRIPTION_ORG),
|
||||
data={"subscription_id": 12345678},
|
||||
data={"subscriptions": [{"subscription_id": 12345678}]},
|
||||
expected_code=201,
|
||||
)
|
||||
self.deleteResponse(
|
||||
@ -5126,6 +5128,49 @@ class TestOrganizationRhSku(ApiTestCase):
|
||||
)
|
||||
self.assertEqual(len(json), 0)
|
||||
|
||||
def test_sku_stacking(self):
|
||||
# multiples of same sku
|
||||
self.login(SUBSCRIPTION_USER)
|
||||
self.postResponse(
|
||||
resource_name=OrganizationRhSku,
|
||||
params=dict(orgname=SUBSCRIPTION_ORG),
|
||||
data={"subscriptions": [{"subscription_id": 12345678}, {"subscription_id": 11223344}]},
|
||||
expected_code=201,
|
||||
)
|
||||
json = self.getJsonResponse(
|
||||
resource_name=OrganizationRhSku,
|
||||
params=dict(orgname=SUBSCRIPTION_ORG),
|
||||
)
|
||||
self.assertEqual(len(json), 2)
|
||||
json = self.getJsonResponse(OrgPrivateRepositories, params=dict(orgname=SUBSCRIPTION_ORG))
|
||||
self.assertEqual(True, json["privateAllowed"])
|
||||
|
||||
def test_batch_sku_remove(self):
|
||||
self.login(SUBSCRIPTION_USER)
|
||||
self.postResponse(
|
||||
resource_name=OrganizationRhSku,
|
||||
params=dict(orgname=SUBSCRIPTION_ORG),
|
||||
data={"subscriptions": [{"subscription_id": 12345678}, {"subscription_id": 11223344}]},
|
||||
expected_code=201,
|
||||
)
|
||||
self.postResponse(
|
||||
resource_name=OrganizationRhSkuBatchRemoval,
|
||||
params=dict(orgname=SUBSCRIPTION_ORG),
|
||||
data={"subscriptions": [{"subscription_id": 12345678}, {"subscription_id": 11223344}]},
|
||||
expected_code=204,
|
||||
)
|
||||
json = self.getJsonResponse(
|
||||
resource_name=OrganizationRhSku, params=dict(orgname=SUBSCRIPTION_ORG)
|
||||
)
|
||||
self.assertEqual(len(json), 0)
|
||||
|
||||
|
||||
class TestUserSku(ApiTestCase):
|
||||
def test_get_user_skus(self):
|
||||
self.login(SUBSCRIPTION_USER)
|
||||
json = self.getJsonResponse(UserSkuList)
|
||||
self.assertEqual(len(json), 2)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
Reference in New Issue
Block a user