Mocking the IntentMessage in Python

#1

Hi everybody,

I am trying to make a new App - but I would like to test everything.

Is there an easy way to mock IntentMessage?

How do you write tests?

Cheers

Michi

#2

You can use MqttSpy, it’s free and easy to send hand crafted mqtt messages

#3

Thank you @Psycho!

I have ended up testing with the original classes used in here.

custom_slot_value = hermes_python.ontology.dialogue.CustomValue("2019-05-17 00:00:00 +00:00")
slot_value = hermes_python.ontology.dialogue.SlotValue(1, custom_slot_value)
nlu_slot = hermes_python.ontology.dialogue.NluSlot(0.8, slot_value, custom_slot_value.value, "snips/datetime", "forecast_start_date_time",20, 26)
slots_list = hermes_python.ontology.dialogue.SlotsList()
slots_list.append(nlu_slot)
slot_map = dict([(nlu_slot.slot_name, slots_list)])
slots = hermes_python.ontology.dialogue.SlotMap(slot_map)

intentMessage = hermes_python.ontology.dialogue.IntentMessage("session_id", "", "site_id", "input", "testIntent", slots)
1 Like