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

Amendment to PR 53 #54

Merged
merged 3 commits into from
May 18, 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
9 changes: 5 additions & 4 deletions backlogger.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@

# Icons used for PASS or FAIL in the md file
result_icons = {"pass": "💚", "fail": "🔴"}
reminder_text = "This ticket was set to **{priority}** priority but was not updated [within the SLO period]({url}). Please consider picking up this ticket or just set the ticket to the next lower priority."
reminder_text_common = "This ticket was set to **{priority}** priority but was not updated [within the SLO period]({url})."
reminder_text = "Please consider picking up this ticket or just set the ticket to the next lower priority."
update_slo_text = "The ticket will be set to the next lower priority **{priority}**."
reminder_regex = (
r"^This ticket was set to .* priority but was not updated.* Please consider"
Expand Down Expand Up @@ -79,7 +80,7 @@ def json_rest(method, url, rest=None):

def issue_reminder(conf, poo, poo_reminder_state):
priority = poo["priority"]["name"]
msg = reminder_text.format(priority=priority, url=data["url"])
msg = " ".join([reminder_text_common.format(priority=priority, url=data["url"]), reminder_text])
if "comment" in conf:
msg = conf["comment"]
if data["reminder-comment-on-issues"]:
Expand Down Expand Up @@ -111,8 +112,8 @@ def _update_issue_priority(poo_id, priority_current, poo_reminder_state, msg):
slo_priorities[priority_current]["next_priority"]["name"],
poo_id))
url = "{}/{}.json".format(data["web"], poo_id)
msg = " ".join(update_slo_text.format(
priority=slo_priorities[priority_current]["next_priority"]["name"]))
msg = " ".join([reminder_text_common.format(priority=priority_current, url=data["url"]), update_slo_text.format(
priority=slo_priorities[priority_current]["next_priority"]["name"])])
json_rest("PUT", url,
{"issue":
{"priority_id": slo_priorities[priority_current]["next_priority"]["id"],
Expand Down
17 changes: 17 additions & 0 deletions tests/test_comments.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,23 @@ def test_automatic_priority_on_issue(self):
out, err = self.capsys.readouterr()
assert re.search(expected_str.format(params[0],
params[1]), out)
calls = [
call(
"GET",
"https://example.com/wiki/1000.json?include=journals",
),
call(
"PUT",
"https://example.com/wiki/1000.json",
{
"issue": {
"priority_id": 3,
"notes": "This ticket was set to **Normal** priority but was not updated [within the SLO period](https://example.com/issues). The ticket will be set to the next lower priority **Low**."
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess it is fine to have static priorities for that case.

}
},
),
]
backlogger.json_rest.assert_has_calls(calls)


def test_issue_with_low_priority_never_change(self):
Expand Down