Beispiel #1
0
def test_handle_create_user_response_status_201(mocked_account_resource_id, capsys):
    httpretty.register_uri(httpretty.GET, misc_ex.MOCK_USERAPI_URL,
                           content_type="application/json",
                           status=201,
                           body=json.dumps(misc_ex.DUMMY_USER_CONTENT))
    response = requests.get(misc_ex.MOCK_USERAPI_URL)

    api.handle_create_user_response(response)

    out, err = capsys.readouterr()
    assert "Added user to account" in out
Beispiel #2
0
def test_handle_create_user_response_status_200_with_already_exists_error(
        mocked_account_resource_id, capsys):
    httpretty.register_uri(httpretty.GET,
                           MOCK_API_URL,
                           content_type="application/json",
                           status=201,
                           body=json.dumps(DUMMY_USER_RESPONSE))
    response = requests.get(MOCK_API_URL)

    api.handle_create_user_response(response)

    out, err = capsys.readouterr()
    assert "Added user to account" in out