Esempio n. 1
0
    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)
Esempio n. 2
0
 def test_controller_log(self):
     assert CMCMessage.log_answer(
         "payload",
         logging.WARNING,
     ) == b"fetch:LOG    :warning :7       :payload"