Esempio n. 1
0
def test_create_user_command__user_already_exists(mocker):
    args = {"user-profile": {"email": "*****@*****.**"}}
    mocker.patch.object(Client, 'get_access_token_', return_value='')
    client = mock_client()

    mocker.patch.object(client,
                        'get_user_id_and_activity_by_mail',
                        return_value=("*****@*****.**", ""))
    mocker.patch.object(client, 'update_user', return_value="")

    iam_user_profile = create_user_command(client, args, 'mapper_out', True,
                                           True)
    outputs = get_outputs_from_user_profile(iam_user_profile)

    assert outputs.get('action') == IAMActions.UPDATE_USER
    assert outputs.get('success') is True
Esempio n. 2
0
def test_create_user_command(mocker):
    args = {"user-profile": {"email": "*****@*****.**"}}
    mocker.patch.object(Client, 'get_access_token_', return_value='')
    client = mock_client()

    mocker.patch.object(IAMUserProfile, 'map_object', return_value={})
    mocker.patch.object(client,
                        'create_user',
                        return_value=SALESFORCE_CREATE_USER_OUTPUT)
    mocker.patch.object(client,
                        'get_user_id_and_activity_by_mail',
                        return_value=(None, None))

    iam_user_profile = create_user_command(client, args, 'mapper_out', True,
                                           True)
    outputs = get_outputs_from_user_profile(iam_user_profile)

    assert outputs.get('action') == IAMActions.CREATE_USER
    assert outputs.get('success') is True
    assert outputs.get('active') is True
    assert outputs.get('id') == '12345'