aboutsummaryrefslogtreecommitdiffstats
path: root/tests/test_cli.py
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-09-10 16:52:03 +0200
committerDanilo M. <danix@danix.xyz>2026-09-10 16:52:03 +0200
commit9fce523fd196d7ab71c2b54eeb02071178506045 (patch)
tree8a296e4da4dd854e69abe0945ce859d9b54d6d84 /tests/test_cli.py
parentb054b3da76bd995cde1e5c1480ef36dbba4eb375 (diff)
downloadabusectl-9fce523fd196d7ab71c2b54eeb02071178506045.tar.gz
abusectl-9fce523fd196d7ab71c2b54eeb02071178506045.zip
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 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0176FYdVfpzUq8S9jecqQqL6
Diffstat (limited to 'tests/test_cli.py')
-rw-r--r--tests/test_cli.py22
1 files changed, 22 insertions, 0 deletions
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()