예제 #1
0
    def test_command_message_deconstruction_reconstruction1(self):
        """CommandMessage survives serialization and deserialization (no filter)"""
        original_message = CommandMessage(
            id="1a2b3c4d",
            app_name="test_app",
            version="10.0.1.101.12301",
            command="TESTINSHIT"
        )

        serialized = original_message.serialize()
        deserialized_message = CommandMessage.deserialize(serialized)

        self.assertEqual(original_message, deserialized_message)
예제 #2
0
    def test_command_message_serialize(self):
        """CommandMessage serialize method works"""
        intent = "COMMAND"

        filter = "10000"
        id = "1"
        app_name = "testing_app"
        version = "0.0.1"
        command = "TEST"

        in_args = [filter, id, app_name, version, intent, command]
        command_message = CommandMessage(
            filter=filter,
            id=id,
            app_name=app_name,
            version=version,
            command=command
        )

        serialized = command_message.serialize()
        out_args = serialized.split(DELIMITER)

        self.assertEqual(in_args, out_args)