def test_send_message_with_output_name(self, module_transport): fake_msg = Message("Petrificus Totalus") fake_msg.custom_properties[ custom_property_name] = custom_property_value fake_msg.output_name = "fake_output_name" fake_output_topic = ("devices/" + fake_device_id + "/modules/" + fake_module_id + "/messages/events/" + before_sys_key + "on" + after_sys_key + "fake_output_name" + topic_separator + custom_property_name + after_sys_key + custom_property_value) mock_mqtt_provider = module_transport._pipeline.provider module_transport.connect() mock_mqtt_provider.on_mqtt_connected() module_transport.send_event(fake_msg) mock_mqtt_provider.connect.assert_called_once_with( module_transport._auth_provider.get_current_sas_token()) mock_mqtt_provider.publish.assert_called_once_with( topic=fake_output_topic, payload=fake_msg.data, callback=ANY)
def create_fake_output_message(): msg = Message(fake_event) msg.message_id = fake_message_id msg.output_name = "fake_output_name" return msg