def test_multiple_disabled_calls(self): manager = server_job.warning_manager() manager.disable_warnings("MSGTYPE", lambda: 10) manager.disable_warnings("MSGTYPE", lambda: 20) manager.enable_warnings("MSGTYPE", lambda: 30) self.assertEqual(manager.is_valid(15, "MSGTYPE"), False) self.assertEqual(manager.is_valid(25, "MSGTYPE"), False) self.assertEqual(manager.is_valid(35, "MSGTYPE"), True)
def test_disabled_changes_is_valid(self): manager = server_job.warning_manager() self.assertEqual(manager.is_valid(15, "MSGTYPE"), True) manager.disable_warnings("MSGTYPE", lambda: 10) self.assertEqual(manager.is_valid(15, "MSGTYPE"), False)
def test_only_enabled(self): manager = server_job.warning_manager() manager.enable_warnings("MSGTYPE", lambda: 10) self.assertEqual(manager.is_valid(20, "MSGTYPE"), True)
def test_never_disabled(self): manager = server_job.warning_manager() self.assertEqual(manager.is_valid(10, "MSGTYPE"), True)