Exemplo n.º 1
0
def test_nubank_request_handler_throws_exception_with_response_attribute():
    response = create_fake_response({}, 400)
    client = Nubank()
    with pytest.raises(NuException) as exception_info:
        client._handle_response(response)

    assert exception_info.value.response == response.json()
def test_nubank_request_handler_throws_exception_status_code_in_the_exception_message(
):
    http_status = 400
    response = create_fake_response({}, http_status)
    client = Nubank()
    with pytest.raises(NuException, match=fr'.*{http_status}.*'):
        client._handle_response(response)
Exemplo n.º 3
0
def test_nubank_request_handler_throws_exception_with_status_code_attribute():
    http_status = 400
    response = create_fake_response({}, http_status)
    client = Nubank()
    with pytest.raises(NuException) as exception_info:
        client._handle_response(response)

    assert exception_info.value.status_code == http_status
Exemplo n.º 4
0
def test_nubank_request_handler_throws_exception_on_status_different_of_200(http_status):
    response = create_fake_response({}, http_status)
    client = Nubank()
    with pytest.raises(NuException):
        client._handle_response(response)