'Test for get role by user and project, user was added into a group.
Test Plan:
- Create a user, a project & a group, add this user to group
- Create roles and grant them to user and project
- Check the role list get by the user and project was as expected'

def test_get_role_by_user_and_project_with_user_in_group(self):

    user_ref = unit.new_user_ref(domain_id=CONF.identity.default_domain_id)
    user_ref = self.identity_api.create_user(user_ref)
    project_ref = unit.new_project_ref(domain_id=CONF.identity.default_domain_id)
    self.resource_api.create_project(project_ref['id'], project_ref)
    group = unit.new_group_ref(domain_id=CONF.identity.default_domain_id)
    group_id = self.identity_api.create_group(group)['id']
    self.identity_api.add_user_to_group(user_ref['id'], group_id)
    role_ref_list = []
    for i in range(2):
        role_ref = unit.new_role_ref()
        self.role_api.create_role(role_ref['id'], role_ref)
        role_ref_list.append(role_ref)
        self.assignment_api.add_role_to_user_and_project(user_id=user_ref['id'], tenant_id=project_ref['id'], role_id=role_ref['id'])
    role_list = self.assignment_api.get_roles_for_user_and_project(user_ref['id'], project_ref['id'])
    self.assertEqual(set([r['id'] for r in role_ref_list]), set(role_list))
