diff --git a/src/argus/notificationprofile/models.py b/src/argus/notificationprofile/models.py index b40e1cfa6..08f07aac9 100644 --- a/src/argus/notificationprofile/models.py +++ b/src/argus/notificationprofile/models.py @@ -140,7 +140,7 @@ def is_empty(self): and self.is_event_type_empty() ) - def incident_fits_tristates(self, incident) -> Dict[str, TriState]: + def get_incident_tristate_checks(self, incident) -> Dict[str, TriState]: if self.are_tristates_empty(): return {} fits_tristates = {} @@ -282,7 +282,7 @@ def incident_fits(self, incident: Incident): checks = {} checks["source"] = self.source_system_fits(incident, data) checks["tags"] = self.tags_fit(incident, data) - tristate_checks = self.filter_wrapper.incident_fits_tristates(incident) + tristate_checks = self.filter_wrapper.get_incident_tristate_checks(incident) for tristate, result in tristate_checks.items(): checks[tristate] = result checks["max_level"] = self.filter_wrapper.incident_fits_maxlevel(incident) diff --git a/tests/notificationprofile/test_models.py b/tests/notificationprofile/test_models.py index 0e47410d4..35d205a76 100644 --- a/tests/notificationprofile/test_models.py +++ b/tests/notificationprofile/test_models.py @@ -79,62 +79,62 @@ class FilterWrapperIncidentFitsTristatesTests(unittest.TestCase): # A tristate must be one of True, False, None # "None" is equivalent to the tristate not being mentioned in the filter at all - def test_incident_fits_tristates_no_tristates_set(self): + def test_get_incident_tristate_checks_no_tristates_set(self): incident = Mock() empty_filter = FilterWrapper({}) - result = empty_filter.incident_fits_tristates(incident) + result = empty_filter.get_incident_tristate_checks(incident) self.assertEqual(result, {}) @override_settings(ARGUS_FALLBACK_FILTER={"acked": True}) - def test_incident_fits_tristates_no_tristates_set_with_fallback(self): + def test_get_incident_tristate_checks_no_tristates_set_with_fallback(self): incident = Mock() # Shouldn't match incident.acked = False empty_filter = FilterWrapper({}) - result = empty_filter.incident_fits_tristates(incident) + result = empty_filter.get_incident_tristate_checks(incident) self.assertEqual(result["open"], None) self.assertEqual(result["acked"], False) self.assertEqual(result["stateful"], None) # Should match incident.acked = True empty_filter = FilterWrapper({}) - result = empty_filter.incident_fits_tristates(incident) + result = empty_filter.get_incident_tristate_checks(incident) self.assertNotIn(False, result.values()) self.assertEqual(result["open"], None) self.assertEqual(result["acked"], True) self.assertEqual(result["stateful"], None) - def test_incident_fits_tristates_is_true(self): + def test_get_incident_tristate_checks_is_true(self): incident = Mock() incident.open = True incident.acked = False incident.stateful = True filter = FilterWrapper({"open": True, "acked": False}) - result = filter.incident_fits_tristates(incident) + result = filter.get_incident_tristate_checks(incident) self.assertTrue(set(result.values())) # all True! self.assertEqual(result["open"], True) self.assertEqual(result["acked"], True) self.assertEqual(result["stateful"], None) - def test_incident_fits_tristates_is_false(self): + def test_get_incident_tristate_checks_is_false(self): incident = Mock() incident.open = True incident.acked = False incident.stateful = True filter = FilterWrapper({"open": False, "acked": False}) - result = filter.incident_fits_tristates(incident) + result = filter.get_incident_tristate_checks(incident) self.assertIn(False, result.values()) self.assertEqual(result["open"], False) self.assertEqual(result["acked"], True) self.assertEqual(result["stateful"], None) @override_settings(ARGUS_FALLBACK_FILTER={"acked": True}) - def test_incident_fits_tristates_fallback_should_not_override(self): + def test_get_incident_tristate_checks_fallback_should_not_override(self): incident = Mock() # Should match incident.acked = False filter = FilterWrapper({"acked": False}) - result = filter.incident_fits_tristates(incident) + result = filter.get_incident_tristate_checks(incident) self.assertEqual(result["acked"], True) self.assertNotIn(False, result.values()) self.assertEqual(result["open"], None)