Add domain admin grant test cases

This commit adds two test cases for domain administrator, specifically
to check that they can add users and groups to their own domain.

Change-Id: I0299d39dc8fca0e91acd277856aaf267bea50c1d
This commit is contained in:
Lance Bragstad 2020-02-05 15:24:11 -06:00
parent 99733f172f
commit 3aacc4dfe7
1 changed files with 28 additions and 0 deletions

View File

@ -2160,6 +2160,20 @@ class DomainAdminTests(base_classes.TestCaseWithBootstrap,
headers=self.headers
)
def test_can_create_grant_for_user_own_domain_on_own_domain(self):
user = PROVIDERS.identity_api.create_user(
unit.new_user_ref(domain_id=self.domain_id)
)
with self.test_client() as c:
c.put(
'/v3/domains/%s/users/%s/roles/%s' % (
self.domain_id, user['id'],
self.bootstrapper.reader_role_id
),
headers=self.headers
)
def test_can_create_grant_for_group_on_project(self):
group = PROVIDERS.identity_api.create_group(
unit.new_group_ref(domain_id=self.domain_id)
@ -2179,6 +2193,20 @@ class DomainAdminTests(base_classes.TestCaseWithBootstrap,
headers=self.headers
)
def test_can_create_grant_for_group_own_domain_on_own_domain(self):
group = PROVIDERS.identity_api.create_group(
unit.new_group_ref(domain_id=self.domain_id)
)
with self.test_client() as c:
c.put(
'/v3/domains/%s/groups/%s/roles/%s' % (
self.domain_id, group['id'],
self.bootstrapper.reader_role_id
),
headers=self.headers
)
def test_can_revoke_grant_from_user_on_project(self):
user = PROVIDERS.identity_api.create_user(
unit.new_user_ref(domain_id=self.domain_id)