Example #1
0
def project_clients(admin_client):
    accounts = make_accounts()
    clients = {}
    for account in ACCOUNT_LIST:
        clients[account] = _client_for_user(account, accounts)
    clients['admin'] = admin_client
    return clients
Example #2
0
def create_github_client(username=None, password=None, project_id=None):
    client = _client_for_user('user', accounts())
    client.delete_by_id = delete_by_id
    assert client.valid()
    jwt = get_authed_token(username=username, password=password)['jwt']
    client._access_key = None
    client._secret_key = None

    client._auth = GithubAuth(jwt, prj_id=project_id)
    client.reload_schema()
    assert client.valid()
    return client
def create_github_client(username=None, password=None, project_id=None):
    client = _client_for_user('user', accounts())
    client.delete_by_id = delete_by_id
    assert client.valid()
    jwt = get_authed_token(username=username, password=password)['jwt']
    client._access_key = None
    client._secret_key = None

    client._auth = GithubAuth(jwt, prj_id=project_id)
    client.reload_schema()
    assert client.valid()
    return client
Example #4
0
def create_ldap_client(username=os.getenv('LDAP_USER1', 'devUserA'),
                       password=os.getenv('LDAP_USER1_PASSWORD', 'Password1'),
                       project_id=None):
    client = _client_for_user('user', accounts())
    client.delete_by_id = delete_by_id
    assert client.valid()
    jwt = get_authed_token(username=username, password=password)['jwt']
    client._access_key = None
    client._secret_key = None

    client._auth = LdapAuth(jwt, prj_id=project_id)
    client.reload_schema()
    assert client.valid()

    identities = client.list_identity()
    assert len(identities) > 0
    is_ldap_user = False
    for identity in identities:
        if (identity.externalIdType == 'ldap_user'):
            is_ldap_user = True
    assert is_ldap_user
    return client
def create_ldap_client(username=os.getenv('LDAP_USER1', 'devUserA'),
                       password=os.getenv('LDAP_USER1_PASSWORD', 'Password1'),
                       project_id=None):
    client = _client_for_user('user', accounts())
    client.delete_by_id = delete_by_id
    assert client.valid()
    jwt = get_authed_token(username=username, password=password)['jwt']
    client._access_key = None
    client._secret_key = None

    client._auth = LdapAuth(jwt, prj_id=project_id)
    client.reload_schema()
    assert client.valid()

    identities = client.list_identity()
    assert len(identities) > 0
    is_ldap_user = False
    for identity in identities:
        if (identity.externalIdType == 'ldap_user'):
            is_ldap_user = True
    assert is_ldap_user
    return client