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
5 changes: 4 additions & 1 deletion mergify_cli/ci/junit_upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,5 +78,8 @@ async def upload( # noqa: PLR0913, PLR0917
)

gigid = response.json()["gigid"]
console.log(f"::notice title=CI Issues report::CI_ISSUE_GIGID={gigid}")
console.print(
f"::notice title=CI Issues report::CI_ISSUE_GIGID={gigid}",
soft_wrap=True,
)
console.log("[green]:tada: File(s) uploaded[/]")
14 changes: 12 additions & 2 deletions mergify_cli/tests/ci_issues/test_junit_upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,12 +131,16 @@ def test_get_files_to_upload() -> None:
assert files_to_upload[0][1][1].closed


async def test_junit_upload(respx_mock: respx.MockRouter) -> None:
async def test_junit_upload(
respx_mock: respx.MockRouter,
capsys: pytest.CaptureFixture[str],
) -> None:
gigid = "eyJjaV9qb2JfaWQiOjcwNzQyLCJzaWduYXR1cmUiOiI2NjcxN2QwZDdiZjZkMzAxMmFmNGE4NWQ1YTFlZDhmYjNkNDBjYmM4MmZjZjgxZTVmNzEzNzEyZjRlZjIxOTFmIn0="
respx_mock.post(
"/v1/repos/user/repo/ci_issues_upload",
).respond(
200,
json={"gigid": "1234azertyuiop"},
json={"gigid": gigid},
)

await junit_upload_mod.upload(
Expand All @@ -149,6 +153,12 @@ async def test_junit_upload(respx_mock: respx.MockRouter) -> None:
(str(REPORT_XML),),
)

captured = capsys.readouterr()
assert (
captured.out.split("\n")[0]
== f"::notice title=CI Issues report::CI_ISSUE_GIGID={gigid}"
)


async def test_junit_upload_http_error(respx_mock: respx.MockRouter) -> None:
respx_mock.post("/v1/repos/user/repo/ci_issues_upload").respond(
Expand Down