'Setup for Token Revoking Test Cases.
As well as the usual housekeeping, create a set of domains,
users, groups, roles and projects for the subsequent tests:
- Two domains: A & B
- Three users (1, 2 and 3)
- Three groups (1, 2 and 3)
- Two roles (1 and 2)
- DomainA owns user1, domainB owns user2 and user3
- DomainA owns group1 and group2, domainB owns group3
- User1 and user2 are members of group1
- User3 is a member of group2
- Two projects: A & B, both in domainA
- Group1 has role1 on Project A and B, meaning that user1 and user2
will get these roles by virtue of membership
- User1, 2 and 3 have role1 assigned to projectA
- Group1 has role1 on Project A and B, meaning that user1 and user2
will get role1 (duplicated) by virtue of membership
- User1 has role2 assigned to domainA'

def setUp(self):

    super(TestTokenRevokeById, self).setUp()
    self.domainA = unit.new_domain_ref()
    self.resource_api.create_domain(self.domainA['id'], self.domainA)
    self.domainB = unit.new_domain_ref()
    self.resource_api.create_domain(self.domainB['id'], self.domainB)
    self.projectA = unit.new_project_ref(domain_id=self.domainA['id'])
    self.resource_api.create_project(self.projectA['id'], self.projectA)
    self.projectB = unit.new_project_ref(domain_id=self.domainA['id'])
    self.resource_api.create_project(self.projectB['id'], self.projectB)
    self.user1 = unit.create_user(self.identity_api, domain_id=self.domainA['id'])
    self.user2 = unit.create_user(self.identity_api, domain_id=self.domainB['id'])
    self.user3 = unit.create_user(self.identity_api, domain_id=self.domainB['id'])
    self.group1 = unit.new_group_ref(domain_id=self.domainA['id'])
    self.group1 = self.identity_api.create_group(self.group1)
    self.group2 = unit.new_group_ref(domain_id=self.domainA['id'])
    self.group2 = self.identity_api.create_group(self.group2)
    self.group3 = unit.new_group_ref(domain_id=self.domainB['id'])
    self.group3 = self.identity_api.create_group(self.group3)
    self.identity_api.add_user_to_group(self.user1['id'], self.group1['id'])
    self.identity_api.add_user_to_group(self.user2['id'], self.group1['id'])
    self.identity_api.add_user_to_group(self.user3['id'], self.group2['id'])
    self.role1 = unit.new_role_ref()
    self.role_api.create_role(self.role1['id'], self.role1)
    self.role2 = unit.new_role_ref()
    self.role_api.create_role(self.role2['id'], self.role2)
    self.assignment_api.create_grant(self.role2['id'], user_id=self.user1['id'], domain_id=self.domainA['id'])
    self.assignment_api.create_grant(self.role1['id'], user_id=self.user1['id'], project_id=self.projectA['id'])
    self.assignment_api.create_grant(self.role1['id'], user_id=self.user2['id'], project_id=self.projectA['id'])
    self.assignment_api.create_grant(self.role1['id'], user_id=self.user3['id'], project_id=self.projectA['id'])
    self.assignment_api.create_grant(self.role1['id'], group_id=self.group1['id'], project_id=self.projectA['id'])
