Merge "Update rbac tests"

This commit is contained in:
Zuul 2023-06-07 18:15:34 +00:00 committed by Gerrit Code Review
commit e765946be1
2 changed files with 93 additions and 0 deletions

View File

@ -193,3 +193,89 @@ class ProjectAdminTests(ProjectMemberTests):
def setup_clients(cls):
super().setup_clients()
cls.client = cls.os_project_admin.secret_v1.QuotaClient()
def test_list_project_quotas(self):
quotas = self.client.list_quotas()
self.assertIn("project_quotas", quotas)
def test_get_custom_quota_for_project(self):
project_id = self.client.tenant_id
self.client.create_project_quota(
project_id,
project_quotas={
"secrets": 1000,
"orders": 1000,
"containers": 1000
})
quota = self.client.get_project_quota(project_id)
self.assertIn("project_quotas", quota)
def test_set_new_quota_for_project(self):
project_id = self.client.tenant_id
self.client.create_project_quota(
project_id,
project_quotas={
"secrets": 1000,
"orders": 1000,
"containers": 1000
})
quota = self.client.get_project_quota(project_id)
self.assertIn("project_quotas", quota)
def test_remove_custom_quota_for_project(self):
project_id = self.client.tenant_id
self.client.create_project_quota(
project_id,
project_quotas={
"secrets": 1000,
"orders": 1000,
"containers": 1000
})
quota = self.client.get_project_quota(project_id)
self.assertIn("project_quotas", quota)
self.client.delete_project_quota(project_id)
self.assertRaises(
exceptions.NotFound,
self.client.get_project_quota,
project_id)
def test_get_custom_quota_for_other_project(self):
project_id = self.other_secret_client.tenant_id
self.client.create_project_quota(
project_id,
project_quotas={
"secrets": 1000,
"orders": 1000,
"containers": 1000
})
quota = self.client.get_project_quota(project_id)
self.assertIn("project_quotas", quota)
def test_set_new_quota_for_other_project(self):
project_id = self.other_secret_client.tenant_id
self.client.create_project_quota(
project_id,
project_quotas={
"secrets": 1000,
"orders": 1000,
"containers": 1000
})
quota = self.client.get_project_quota(project_id)
self.assertIn("project_quotas", quota)
def test_remove_custom_quota_for_other_project(self):
project_id = self.other_secret_client.tenant_id
self.client.create_project_quota(
project_id,
project_quotas={
"secrets": 1000,
"orders": 1000,
"containers": 1000
})
quota = self.client.get_project_quota(project_id)
self.assertIn("project_quotas", quota)
self.client.delete_project_quota(project_id)
self.assertRaises(
exceptions.NotFound,
self.client.get_project_quota,
project_id)

View File

@ -112,6 +112,13 @@ class ProjectAdminTests(ProjectMemberTests):
super().setup_clients()
cls.client = cls.os_project_admin.secret_v1.TransportKeyClient()
def test_create_transport_key(self):
transport_key = self.client.create_transport_key(
plugin_name="simple-crypto",
transport_key="UUUU-UUUU-IIII-DDDD"
)
self.assertIn("transport_key_ref", transport_key)
class ProjectReaderTests(ProjectMemberTests):