Esempio n. 1
0
def test_image_load():
    client = echo_client.client_class()
    returnMessage = client.client_run("GET /images/sample_1.png HTTP/1.1\r\nHost: 127.0.0.1:50000\r\n\r\n")
    assert "Content-Length: 8760\r\n" in returnMessage
Esempio n. 2
0
def test_bad_protocol():
    client = echo_client.client_class()
 #   time.sleep(1)
    returnMessage = client.client_run("GET /hello.html HTT1.1\r\n\r\n")
    assert "WRONG PROTOCOL" in returnMessage
Esempio n. 3
0
def test_injection_attack():
    client = echo_client.client_class()
    returnMessage = client.client_run("GET /../hello.html HTTP/1.1\r\nHost: 127.0.0.1:50000\r\n\r\n")
    assert "FILE NOT FOUND" in returnMessage
Esempio n. 4
0
def test_bad_URI():
    """This error should be returned because there is no '/' before the hello.html file"""
    client = echo_client.client_class()
 #   time.sleep(1)
    returnMessage = client.client_run("GET hello.html HTTP/1.1\r\n\r\n")
    assert returnMessage == "HTTP/1.1 400 Y U SO BAD\r\n\r\n<h1> 400 - Y U SO BAD </h1>"
Esempio n. 5
0
def test_good_URI():
    client = echo_client.client_class()
 #   time.sleep(1)
    returnMessage = client.client_run("GET /sample.txt HTTP/1.1\r\nHost: 127.0.0.1:50000\r\n\r\n")
    assert "very simple text file" in returnMessage
Esempio n. 6
0
def test_image_load():
    client = echo_client.client_class()
    returnMessage = client.client_run(
        "GET /images/sample_1.png HTTP/1.1\r\nHost: 127.0.0.1:50000\r\n\r\n")
    assert "Content-Length: 8760\r\n" in returnMessage
Esempio n. 7
0
def test_injection_attack():
    client = echo_client.client_class()
    returnMessage = client.client_run(
        "GET /../hello.html HTTP/1.1\r\nHost: 127.0.0.1:50000\r\n\r\n")
    assert "FILE NOT FOUND" in returnMessage
Esempio n. 8
0
def test_bad_protocol():
    client = echo_client.client_class()
    #   time.sleep(1)
    returnMessage = client.client_run("GET /hello.html HTT1.1\r\n\r\n")
    assert "WRONG PROTOCOL" in returnMessage
Esempio n. 9
0
def test_good_URI():
    client = echo_client.client_class()
    #   time.sleep(1)
    returnMessage = client.client_run(
        "GET /sample.txt HTTP/1.1\r\nHost: 127.0.0.1:50000\r\n\r\n")
    assert "very simple text file" in returnMessage
Esempio n. 10
0
def test_bad_URI():
    """This error should be returned because there is no '/' before the hello.html file"""
    client = echo_client.client_class()
    #   time.sleep(1)
    returnMessage = client.client_run("GET hello.html HTTP/1.1\r\n\r\n")
    assert returnMessage == "HTTP/1.1 400 Y U SO BAD\r\n\r\n<h1> 400 - Y U SO BAD </h1>"