diff --git a/backlogger.py b/backlogger.py index 020f7bc..b655418 100755 --- a/backlogger.py +++ b/backlogger.py @@ -98,7 +98,7 @@ def reminder_exists(conf, poo, msg): if "journals" in root["issue"]: journals = root["issue"]["journals"] for journal in journals: - if not "notes" in journal or len(journal["notes"]) == 0: + if journal.get("notes", None) is None or len(journal["notes"]) == 0: continue if re.search(reminder_regex, journal["notes"]): return True diff --git a/tests/test_comments.py b/tests/test_comments.py index 93d3aa0..5524364 100755 --- a/tests/test_comments.py +++ b/tests/test_comments.py @@ -56,6 +56,7 @@ def test_comments(self): ] backlogger.json_rest.assert_has_calls(calls) + def test_no_repeat(self): data = {"url": "https://example.com/issues", "web": "https://example.com/wiki", "api": "https://example.com/issues.json", @@ -67,8 +68,9 @@ def test_no_repeat(self): "priority": { "id": 6, "name": "Urgent" }, "journals": [ { "id": 1, "notes": "" }, + { "id": 2, "notes": None }, { - "id": 2, + "id": 3, "notes": "This ticket was set to **High** priority but was not updated [within the SLO period](https://example.com/issues). Please consider picking up this ticket or just set the ticket to the next lower priority.", }, ],