Exemplo n.º 1
0
def test_RequestException():
    m = mock.Mock(
        side_effect=requests.RequestException(),
        __name__='m',
    )
    f = suds_requests.handle_errors(m)
    with pytest.raises(suds.transport.TransportError) as excinfo:
        f()
    assert excinfo.value.httpcode == 000
Exemplo n.º 2
0
def test_HTTPError():
    resp = mock.Mock(status_code=404)
    m = mock.Mock(
        side_effect=requests.HTTPError(response=resp),
        __name__='m',
    )
    f = suds_requests.handle_errors(m)
    with pytest.raises(suds.transport.TransportError) as excinfo:
        f()
    assert excinfo.value.httpcode == 404
Exemplo n.º 3
0
def test_no_errors():
    m = mock.Mock(__name__='m')
    f = suds_requests.handle_errors(m)
    assert f() == m.return_value