aboutsummaryrefslogtreecommitdiffstats
path: root/tests/test_init.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_init.py')
-rw-r--r--tests/test_init.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/test_init.py b/tests/test_init.py
index 4f2042c..55153f4 100644
--- a/tests/test_init.py
+++ b/tests/test_init.py
@@ -348,3 +348,24 @@ class TestRepeatedInit(unittest.TestCase):
self.assertEqual(text.count("# Later parts of abusectl"), 1)
# The unknown section still rides across untouched.
self.assertEqual(tomllib.loads(text)["misp"]["api_key"], "SECRET")
+
+ def test_the_footer_survives_an_identity_answered_then_skipped(self):
+ # The sequence a hand test actually hit, and the one the first fix
+ # missed: answering the identity, then re-running and skipping it,
+ # leaves [reporter] PRESERVED rather than rendered, so the footer
+ # trailing it rides across while this run emits its own.
+ relays = {"trusted_relays": ["192.0.2.0/24"], "cases": ""}
+ answered = dict(relays, reporter_name="A Reporter",
+ reporter_org="example.org",
+ reporter_email="r@example.org")
+ with tempfile.TemporaryDirectory() as tmp:
+ path = pathlib.Path(tmp) / "config.toml"
+ init.write(path, answered)
+ init.write(path, relays, force=True)
+
+ text = path.read_text()
+ self.assertEqual(text.count("# Later parts of abusectl"), 1)
+ self.assertEqual(text.count("# abusectl configuration."), 1)
+ self.assertEqual(
+ tomllib.loads(text)["reporter"]["name"], "A Reporter"
+ )