'Create credentials with random name.
Creates project and user. When admin flag is True create user
with admin role. Assign user with additional roles (for example
_member_) and roles requested by caller.
:param admin: Flag if to assign to the user admin role
:type admin: bool
:param roles: Roles to assign for the user
:type roles: list
:return: Readonly Credentials with network resources'

def _create_creds(self, admin=False, roles=None):

    root = self.name
    project_name = data_utils.rand_name(root, prefix=self.resource_prefix)
    project_desc = (project_name + '-desc')
    project = self.creds_client.create_project(name=project_name, description=project_desc)
    username = project_name
    user_password = data_utils.rand_password()
    email = (data_utils.rand_name(root, prefix=self.resource_prefix) + '@example.com')
    user = self.creds_client.create_user(username, user_password, project, email)
    role_assigned = False
    if admin:
        self.creds_client.assign_user_role(user, project, self.admin_role)
        role_assigned = True
        if ((self.identity_version == 'v3') and self.identity_admin_domain_scope):
            self.creds_client.assign_user_role_on_domain(user, self.identity_admin_role)
    for conf_role in self.extra_roles:
        self.creds_client.assign_user_role(user, project, conf_role)
        role_assigned = True
    if roles:
        for role in roles:
            self.creds_client.assign_user_role(user, project, role)
            role_assigned = True
    if ((self.identity_version == 'v3') and (not role_assigned)):
        try:
            self.creds_client.create_user_role('Member')
        except lib_exc.Conflict:
            LOG.warning('Member    role    already    exists,    ignoring    conflict.')
        self.creds_client.assign_user_role(user, project, 'Member')
    creds = self.creds_client.get_credentials(user, project, user_password)
    return cred_provider.TestResources(creds)
