コード例 #1
0
def test_405():

    _client = Client()
    _client.send("PUT / HTTP/1.1")
    assert _client.receive() == 'HTTP/1.1 405 Method Not Allowed\r\nContent-Type: text/plain\r\n\r\n405 Method Not Allowed'
    _client = Client()
    _client.send("HEAD / HTTP/1.1")
    assert _client.receive() == 'HTTP/1.1 405 Method Not Allowed\r\nContent-Type: text/plain\r\n\r\n405 Method Not Allowed'
コード例 #2
0
ファイル: test_echo.py プロジェクト: EyuelAbebe/Network_tools
def test_echo():

    _server = Server().serve()

    _client = Client()
    _client.send("Hi there")
    assert _client.receive() == "Hi there"
コード例 #3
0
ファイル: test_echo.py プロジェクト: EyuelAbebe/Network_tools
def test_echo():

    _server = Server().serve()

    _client = Client()
    _client.send("Hi there")
    assert _client.receive() == "Hi there"
コード例 #4
0
def test_200():

    _client = Client()
    _client.send("GET / HTTP/1.1")
    assert _client.receive() == 'HTTP/1.1 200 OK\r\nContent-Type: text/plain\r\n\r\n200 OK'
コード例 #5
0
def test_505():

    _client = Client()
    _client.send("GET / HTTP/1.0")
    assert _client.receive() == 'HTTP/1.1 505 HTTP Version Not Supported\r\nContent-Type: text/plain\r\n\r\n505 HTTP Version Not Supported'
コード例 #6
0
def test_400():

    _client = Client()
    _client.send("GET HTTP/1.1")
    assert _client.receive() == 'HTTP/1.1 400 Bad Request\r\nContent-Type: text/plain\r\n\r\n400 Bad Request'
コード例 #7
0
def client_send_receive(message):
    _client = Client()
    _client.send(message)
    print _client.receive()
コード例 #8
0
def client_send_receive(message):
    _client = Client()
    _client.send(message)
    print _client.receive()