def test_02_Message(self): """ No payload (not too useful) """ l_message = Util._make_message(self.m_pyhouse_obj) # print(PrettyFormatAny.form(l_message, 'Bare Message', 80)) self.assertEqual(self.jsonPair(l_message, 'Sender'), self.m_pyhouse_obj.Computer.Name) self.assertSubstring('DateTime', l_message)
def test_03_MessageObj(self): """ Add an object. """ l_data = ScheduleLightData() l_data.Name = 'Mqtt Controller Object' l_data.RoomName = 'Living Room' l_data.Comment = 'The formal Living Room.' l_message = Util._make_message(self.m_pyhouse_obj, l_data) # print(PrettyFormatAny.form(l_message, 'Message', 80)) self.assertEqual(self.jsonPair(l_message, 'Sender'), self.m_pyhouse_obj.Computer.Name) self.assertSubstring('DateTime', l_message) self.assertEqual(self.jsonPair(l_message, 'Name'), l_data.Name)
def test_01_Topic(self): """ Test topic. """ l_topic = Util._make_topic(self.m_pyhouse_obj, 'Test') self.assertEqual(l_topic, "pyhouse/test_house/Test")