From 9fce523fd196d7ab71c2b54eeb02071178506045 Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Thu, 10 Sep 2026 16:52:03 +0200 Subject: feat: warn when no reporting destination is configured report exits zero and writes bodies for a case with only abuse-desk contacts, since that is a perfectly good report on its own. But a user who believes MISP is configured and finds no misp row has a typo'd section name, and MISP gates everything irreversible, so a stderr warning naming the config path catches that before submit time. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_0176FYdVfpzUq8S9jecqQqL6 --- tests/test_cli.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'tests') diff --git a/tests/test_cli.py b/tests/test_cli.py index 89da6b0..3638edd 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -458,6 +458,28 @@ class ReportCommand(unittest.TestCase): self.assertEqual(written["destinations"], []) self.assertEqual(written["unreportable"], []) + def test_no_configured_destination_warns_and_still_exits_zero(self): + self._write_config('[reporter]\nemail = "r@example.org"\n') + case_path = self._make_case() + code, _, err = self._run( + "--config", str(self.config), "report", str(case_path) + ) + self.assertEqual(code, 0) + self.assertIn("no reporting destinations", err) + self.assertIn(str(self.config), err) + + def test_a_configured_destination_produces_no_warning(self): + self._write_config( + '[reporter]\nemail = "r@example.org"\n' + '\n[abusedb]\napi_key = "k"\n' + ) + case_path = self._make_case() + code, _, err = self._run( + "--config", str(self.config), "report", str(case_path) + ) + self.assertEqual(code, 0) + self.assertNotIn("no reporting destinations", err) + if __name__ == "__main__": unittest.main() -- cgit v1.2.3