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'
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)
def test_command_error_raise(): with pytest.raises(error.InvalidCommand): utils.__command('hi', 'InvalidCmd')