コード例 #1
0
ファイル: conftest.py プロジェクト: healthverity/circleci_poc
def create_test_users(request, start_pennyworth_db_connection):
    """
    Gets login credentials for the test users. If using the database,
    creates the test users with a series of queries to the Pennyworth db.

    Credentials are stored in SSM with the following format:
    {
        "user_type1": {
            "username": "******",
            "password": "******",
            "passhash": "..."
        },
        ...
    }
    """
    all_user_creds = db.get_test_user_credentials(
        request.config.getoption('stage'))
    for user_type in all_user_creds.keys():
        user_creds = all_user_creds[user_type]
        BaseDriver.USERS_MAP[user_type] = BaseDriver.Credentials(**user_creds)
    if request.config.getoption('use_database'):
        for user_type in all_user_creds.keys():
            user_creds = all_user_creds[user_type]
            BaseDriver.USER_IDS[user_type] = db.setup_user(
                user_creds['username'], user_type, user_creds['passhash'])