def test_log_answer(self): log_message = "the log message" level = logging.WARN message = CMCMessage.log_answer(log_message, level) assert CMCMessage.from_bytes(bytes(message)) == message assert message.header.name == "fetch" assert message.header.state == CMCHeader.State.LOG assert message.header.log_level.strip() == "warning" assert message.header.payload_length == len(message) - len( message.header) assert message.header.payload_length == len(log_message)
def test_controller_log(self): assert CMCMessage.log_answer( "payload", logging.WARNING, ) == b"fetch:LOG :warning :7 :payload"