Example #1
0
def test_handle_request_range_from_middle():
    # setup
    clientsock = MockClientSocket(recv_data=HTTP_REQUEST_RANGE_FROM_MIDDLE)

    # run
    handle_request(clientsock)

    # assert
    tools.assert_equals(clientsock.sent_data, HTTP_RESPONSE_RANGE_FROM_MIDDLE)
Example #2
0
def test_handle_request_known_file():
    #setup
    clientsock = MockClientSocket(recv_data=HTTP_REQUEST_KNOWN_FILE)

    #run
    handle_request(clientsock)

    # assert
    tools.assert_equals(clientsock.close_called, True)
    tools.assert_equals(clientsock.sent_data, HTTP_RESPONSE_KNOWN_FILE)