def test__publish_with_exception(self): conn = RabbitMQConnector() testutils.set_priv_attr(conn, "__publish_raw", None) target_func = testutils.get_priv_attr(conn, "__publish") with self.assertRaises(hap.Signal) as cm: target_func("msg") self.assertTrue(cm.exception.critical)
def test__publish_with_exception(self): conn = RabbitMQConnector() testutils.set_priv_attr(conn, "__publish_raw", None) target_func = testutils.get_priv_attr(conn, "__publish") with self.assertRaises(hap.Signal) as cm: target_func("msg") self.assertTrue(cm.exception.critical)
def test_reset(self): targets = ("__previous_hosts", "__previous_host_groups", "__previous_host_group_membership", "__event_last_info") # Set arbitary data to each member hapiproc = self.__create_test_instance() for attr_name in targets: testutils.set_priv_attr(hapiproc, attr_name, "Test Data") hapiproc.reset() for attr_name in targets: self.assertIsNone(testutils.get_priv_attr(hapiproc, attr_name))
def test_reset(self): targets = ("__previous_hosts", "__previous_host_groups", "__previous_host_group_membership", "__event_last_info") # Set arbitary data to each member hapiproc = self.__create_test_instance() for attr_name in targets: testutils.set_priv_attr(hapiproc, attr_name, "Test Data") hapiproc.reset() for attr_name in targets: self.assertIsNone(testutils.get_priv_attr(hapiproc, attr_name))
def test_get_ms_info(self): hapiproc = self.__create_test_instance() test_ms = "test_ms" testutils.set_priv_attr(hapiproc, "__ms_info", test_ms) self.assertEquals(hapiproc.get_ms_info(), test_ms)
def test_get_ms_info(self): hapiproc = self.__create_test_instance() test_ms = "test_ms" testutils.set_priv_attr(hapiproc, "__ms_info", test_ms) self.assertEquals(hapiproc.get_ms_info(), test_ms)