Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle empty "notes" key #36

Merged
merged 1 commit into from
Mar 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion backlogger.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion tests/test_comments.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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.",
},
],
Expand Down
Loading