コード例 #1
0
def test_unknown_url_no_exception():
    # Shouldn't leak any socket or HTTPExceptions
    response = HttpClientUploader.upload(url="http://nowhere.example.com",
                                         data=b"{}",
                                         headers=[])

    assert type(response) is ping_uploader.RecoverableFailure
コード例 #2
0
def test_500_error(safe_httpserver):
    safe_httpserver.serve_content(b"", code=500)

    response = HttpClientUploader.upload(url=safe_httpserver.url,
                                         data=b"{}",
                                         headers=[])

    assert type(response) is ping_uploader.HttpResponse
    assert 500 == response._status_code
    assert 1 == len(safe_httpserver.requests)
コード例 #3
0
def test_unknown_scheme():
    response = HttpClientUploader.upload(url="ftp://example.com/",
                                         data=b"{}",
                                         headers=[])

    assert type(response) is ping_uploader.UnrecoverableFailure
コード例 #4
0
ファイル: test_network.py プロジェクト: zalun/glean
def test_unknown_url_no_exception():
    # Shouldn't leak any socket or HTTPExceptions
    assert not HttpClientUploader.upload("http://nowhere.example.com", "{}", [])