예제 #1
0
def test_error4():
    """Wrong number of elements returned in response line"""
    with pytest.raises(errors.TestError):
        http_ua = http.HttpUA()
        response = http.HttpResponse("HTTP1.1 OK\r\n", http_ua)
예제 #2
0
def test_error3():
    """Invalid status returned in response line"""
    http_ua = http.HttpUA()
    with pytest.raises(errors.TestError):
        response = http.HttpResponse("HTTP1.1 test OK\r\n", http_ua)
예제 #3
0
def test_error6():
    """Valid HTTP response should process fine"""
    http_ua = http.HttpUA()
    response = http.HttpResponse("HTTP/1.1 200 OK\r\ntest: hello\r\n", http_ua)
예제 #4
0
def test_error7():
    """Invalid content-type should fail"""
    http_ua = http.HttpUA()
    with pytest.raises(errors.TestError):
        response = http.HttpResponse(
            "HTTP/1.1 200 OK\r\nContent-Encoding: XYZ\r\n", http_ua)
예제 #5
0
def test_error5():
    """Invalid Header should cause error"""
    http_ua = http.HttpUA()
    with pytest.raises(errors.TestError):
        response = http.HttpResponse("HTTP/1.1 200 OK\r\ntest\r\n", http_ua)