Ejemplo n.º 1
0
def test_recv_function_something_to_recv(sock):
    msg = utils.__command('nothing', 'MSG')
    s = sock.get(tosend=msg)
    cmd, m = utils.recv(s)
    assert cmd == 'MSG'
    assert m == 'nothing'
Ejemplo n.º 2
0
def test_command_generation():
    assert (b'hi' and b'MSG') in utils.__command('hi', 'MSG')
    assert (b'hi' and b'QUIT') in utils.__command('hi', 'QUIT')
    assert (b'hi' and b'ASSUME') in utils.__command('hi', 'ASSUME')
    assert isinstance(utils.__command('hi', 'MSG'), bytes)
Ejemplo n.º 3
0
def test_command_error_raise():
    with pytest.raises(error.InvalidCommand):
        utils.__command('hi', 'InvalidCmd')