def test_set_endpoint_no_notify(self): n = Monitorable() parent = Mock() endpoint = Mock() # Check that the mock looks like it is serializable self.assertTrue(hasattr(endpoint, "to_dict")) n.set_process_path(parent, ("test_n",)) n.endpoints = ["end"] n.set_endpoint_data("end", endpoint, notify=False) self.assertEqual(n.end, endpoint) self.assertEqual(parent.report_changes.called, False)
def test_set_endpoint(self): n = Monitorable() parent = Mock() endpoint = Mock() # Check that the mock looks like it is serializable self.assertTrue(hasattr(endpoint, "to_dict")) n.set_process_path(parent, ["test_n"]) n.endpoints = ["end"] n.set_endpoint_data("end", endpoint, notify=True) self.assertEqual(n.end, endpoint) parent.report_changes.assert_called_once_with( [["test_n", "end"], endpoint.to_dict()])
def test_init(self): p = Mock() n = Monitorable() n.set_process_path(p, ["notifier"]) self.assertEqual(["notifier"], n.process_path)