'Verify getting a token in a tenant with group roles.'

def test_auth_token_project_group_role(self):

    self.assignment_api.add_role_to_user_and_project(self.user_foo['id'], self.tenant_bar['id'], self.role_member['id'])
    domain1 = unit.new_domain_ref()
    self.resource_api.create_domain(domain1['id'], domain1)
    new_group = unit.new_group_ref(domain_id=domain1['id'])
    new_group = self.identity_api.create_group(new_group)
    self.identity_api.add_user_to_group(self.user_foo['id'], new_group['id'])
    self.assignment_api.create_grant(group_id=new_group['id'], project_id=self.tenant_bar['id'], role_id=self.role_admin['id'])
    body_dict = _build_user_auth(username='foo', password='foo2', tenant_name='BAR')
    scoped_token = self.controller.authenticate(self.make_request(), body_dict)
    tenant = scoped_token['access']['token']['tenant']
    roles = scoped_token['access']['metadata']['roles']
    self.assertEqual(self.tenant_bar['id'], tenant['id'])
    self.assertIn(self.role_member['id'], roles)
    self.assertIn(self.role_admin['id'], roles)
