def test_eot():
    """
    Server should already have closed up shop, so the
    client should no longer be able to connect
    """
    with pytest.raises(socket.error):
        echo_client(u"Testing 1 2 3")
Ejemplo n.º 2
0
def test_random():
    test1 = urandom(100)
    assert echo_client(test1) == test1
Ejemplo n.º 3
0
def test_echo():
    assert echo_client('Test message') == 'Test message'
Ejemplo n.º 4
0
def test_long():
    long_msg = b'\x00' * 31
    assert echo_client(long_msg) == long_msg
Ejemplo n.º 5
0
def test_string():
    assert echo_client(u"Enter a message to be sent") == \
        'Enter a message to be sent'
Ejemplo n.º 6
0
 def test_short(self):
     short_message = "darling"
     self.assertEqual(short_message, echo_client.echo_client(short_message))
Ejemplo n.º 7
0
 def test_exact(self):
     exact_message = "abcdefghijklmnopqrstuvwxyz123456"
     self.assertEqual(exact_message, echo_client.echo_client(exact_message))
Ejemplo n.º 8
0
 def test_long(self):
     long_message = "3.1415926535897932384626433832795028841971693993"
     self.assertEqual(long_message, echo_client.echo_client(long_message))
def test_eof():
    assert echo_client(u"End of Transmission") == u"End of Transmission"
def test_unicode():
    assert echo_client(u"ẋṹẁűüƙĝčẳ") == u"ẋṹẁűüƙĝčẳ"
def test_long_buffer():
    long_string = str(range(100)).encode('utf-8')
    assert echo_client(long_string) == long_string
def test_success(init_server):
    assert echo_client(u"Testing 1 2 3") == u"Testing 1 2 3"
Ejemplo n.º 13
0
def test_echo_client_and_server():
    for test in tests:
        assert echo_client(test) == test