Skip to content
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
8 changes: 4 additions & 4 deletions miss_islington/status_change.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,15 +106,15 @@ async def check_ci_status_and_approval(
)
success = result["state"] == "success" and not failure
if leave_comment:
if success:
emoji = "✅"
status = "it's a success"
if failure:
emoji = "❌"
status = "it's a failure or timed out"
else:
elif not success:
emoji = "❌"
status = "it's a failure"
else:
emoji = "✅"
status = "it's a success"
message = f"Status check is done, and {status} {emoji}."
if not success:
if is_automerge:
Expand Down
21 changes: 14 additions & 7 deletions tests/test_status_change.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,8 @@ async def test_ci_passed_with_awaiting_merge_label_pr_is_merged():

gh = FakeGH(getitem=getitem, getiter=getiter)
await status_change.router.dispatch(event, gh)
assert len(gh.post_data["body"]) is not None # leaves a comment
expected_body = "Status check is done, and it's a success ✅."
assert gh.post_data["body"] == expected_body
assert gh.put_data["sha"] == sha # is merged
assert gh.put_data["merge_method"] == "squash"
assert (
Expand Down Expand Up @@ -196,7 +197,8 @@ async def test_ci_and_check_run_passed_with_no_awaiting_merge_label_pr_is_not_me

gh = FakeGH(getitem=getitem)
await status_change.router.dispatch(event, gh)
assert len(gh.post_data["body"]) is not None # leaves a comment
expected_body = "Status check is done, and it's a success ✅."
assert gh.post_data["body"] == expected_body
assert not hasattr(gh, "put_data") # is not merged


Expand Down Expand Up @@ -252,7 +254,8 @@ async def test_ci_not_passed_awaiting_merge_label_pr_is_not_merged():

gh = FakeGH(getitem=getitem)
await status_change.router.dispatch(event, gh)
assert len(gh.post_data["body"]) is not None # leaves a comment
expected_body = "@miss-islington and @Mariatta: Status check is done, and it's a failure ❌."
assert gh.post_data["body"] == expected_body
assert not hasattr(gh, "put_data") # is not merged


Expand Down Expand Up @@ -320,7 +323,8 @@ async def test_ci_passed_and_check_run_failure_awaiting_merge_label_pr_is_not_me

gh = FakeGH(getitem=getitem, getiter=getiter)
await status_change.router.dispatch(event, gh)
assert len(gh.post_data["body"]) is not None # leaves a comment
expected_body = "@miss-islington and @Mariatta: Status check is done, and it's a failure or timed out ❌."
assert gh.post_data["body"] == expected_body
assert not hasattr(gh, "put_data") # is not merged


Expand Down Expand Up @@ -398,7 +402,8 @@ async def test_automerge_with_check_run_failure():

gh = FakeGH(getitem=getitem, getiter=getiter)
await status_change.router.dispatch(event, gh)
assert len(gh.post_data["body"]) is not None # leaves a comment
expected_body = "@Mariatta: Status check is done, and it's a failure or timed out ❌."
assert gh.post_data["body"] == expected_body
assert not hasattr(gh, "put_data") # is not merged


Expand Down Expand Up @@ -466,7 +471,8 @@ async def test_ci_passed_and_check_run_pending_awaiting_merge_label_pr_is_not_me

gh = FakeGH(getitem=getitem, getiter=getiter)
await status_change.router.dispatch(event, gh)
assert len(gh.post_data["body"]) is not None # leaves a comment
expected_body = "@miss-islington and @Mariatta: Status check is done, and it's a failure or timed out ❌."
assert gh.post_data["body"] == expected_body
assert not hasattr(gh, "put_data") # is not merged


Expand Down Expand Up @@ -1342,7 +1348,8 @@ async def test_ci_passed_automerge():

gh = FakeGH(getitem=getitem, getiter=getiter)
await status_change.router.dispatch(event, gh)
assert len(gh.post_data["body"]) is not None # leaves a comment
expected_body = "Status check is done, and it's a success ✅."
assert gh.post_data["body"] == expected_body
assert gh.put_data["sha"] == sha # is merged
assert gh.put_data["merge_method"] == "squash"
assert (
Expand Down