Skip to content

Commit

Permalink
Merge branch 'main' into issue-362b
Browse files Browse the repository at this point in the history
  • Loading branch information
JerrySentry committed Aug 30, 2023
2 parents 6e0f86e + 0246588 commit b76da11
Show file tree
Hide file tree
Showing 6 changed files with 60 additions and 28 deletions.
2 changes: 1 addition & 1 deletion services/notification/notifiers/mixins/message/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ async def _possibly_write_gh_app_login_announcement(
and not owner.integration_id
and not is_enterprise()
):
message_to_display = "Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please [install the Github App Integration](https://github.com/apps/codecov) for your organization. [Read more](https://about.codecov.io/blog/codecov-is-updating-its-github-integration/)."
message_to_display = "Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please [install the GitHub App Integration](https://github.com/apps/codecov) for your organization. [Read more](https://about.codecov.io/blog/codecov-is-updating-its-github-integration/)."
write(f":exclamation: {message_to_display}")
write("")

Expand Down
33 changes: 21 additions & 12 deletions services/notification/notifiers/mixins/message/sections.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,20 +80,29 @@ async def write_section(*args, **kwargs):

class NewFooterSectionWriter(BaseSectionWriter):
async def do_write_section(self, comparison, diff, changes, links, behind_by=None):
repo_service = comparison.repository_service.service
yield ("")
yield (
"[:umbrella: View full report in Codecov by Sentry]({0}?src=pr&el=continue). ".format(
links["pull"]
hide_project_coverage = self.settings.get("hide_project_coverage", False)
if hide_project_coverage:
yield ("")
yield (
":loudspeaker: Thoughts on this report? [Let us know!]({0}).".format(
"https://about.codecov.io/pull-request-comment-report/"
)
)
)
yield (
":loudspeaker: Have feedback on the report? [Share it here]({0}).".format(
"https://about.codecov.io/codecov-pr-comment-feedback/"
if repo_service == "github"
else "https://gitlab.com/codecov-open-source/codecov-user-feedback/-/issues/4"
else:
repo_service = comparison.repository_service.service
yield ("")
yield (
"[:umbrella: View full report in Codecov by Sentry]({0}?src=pr&el=continue). ".format(
links["pull"]
)
)
yield (
":loudspeaker: Have feedback on the report? [Share it here]({0}).".format(
"https://about.codecov.io/codecov-pr-comment-feedback/"
if repo_service == "github"
else "https://gitlab.com/codecov-open-source/codecov-user-feedback/-/issues/4"
)
)
)


class NewHeaderSectionWriter(BaseSectionWriter):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ interactions:
50.00% compared to head [(`2e2600a`)](https://app.codecov.io/gh/ThiagoCodecov/example-python/pull/15?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Vernon+Cooper)
60.00%.\n\n:exclamation: Your organization is not using the GitHub App Integration.
As a result you may experience degraded service beginning May 15th. Please [install
the Github App Integration](https://github.com/apps/codecov) for your organization.
the GitHub App Integration](https://github.com/apps/codecov) for your organization.
[Read more](https://about.codecov.io/blog/codecov-is-updating-its-github-integration/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Vernon+Cooper).\n\n<details><summary>Additional
details and impacted files</summary>\n\n\n[![Impacted file tree graph](https://app.codecov.io/gh/ThiagoCodecov/example-python/pull/15/graphs/tree.svg?width=650&height=150&src=pr&token=abcdefghij&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Vernon+Cooper)](https://app.codecov.io/gh/ThiagoCodecov/example-python/pull/15?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Vernon+Cooper)\n\n```diff\n@@ Coverage
Diff @@\n## master #15 +/- ##\n=============================================\n+
Expand Down Expand Up @@ -137,7 +137,7 @@ interactions:
50.00% compared to head [(`2e2600a`)](https://app.codecov.io/gh/ThiagoCodecov/example-python/pull/15?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Vernon+Cooper)
60.00%.\\n\\n:exclamation: Your organization is not using the GitHub App Integration.
As a result you may experience degraded service beginning May 15th. Please [install
the Github App Integration](https://github.com/apps/codecov) for your organization.
the GitHub App Integration](https://github.com/apps/codecov) for your organization.
[Read more](https://about.codecov.io/blog/codecov-is-updating-its-github-integration/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Vernon+Cooper).\\n\\n<details><summary>Additional
details and impacted files</summary>\\n\\n\\n[![Impacted file tree graph](https://app.codecov.io/gh/ThiagoCodecov/example-python/pull/15/graphs/tree.svg?width=650&height=150&src=pr&token=abcdefghij&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Vernon+Cooper)](https://app.codecov.io/gh/ThiagoCodecov/example-python/pull/15?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Vernon+Cooper)\\n\\n```diff\\n@@
\ Coverage Diff @@\\n## master #15
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ async def test_notify(self, sample_comparison, codecov_vcr, mock_configuration):
"> Report is 52 commits behind head on master.",
"> The diff coverage is `n/a`.",
"",
":exclamation: Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please [install the Github App Integration](https://github.com/apps/codecov) for your organization. [Read more](https://about.codecov.io/blog/codecov-is-updating-its-github-integration/).",
":exclamation: Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please [install the GitHub App Integration](https://github.com/apps/codecov) for your organization. [Read more](https://about.codecov.io/blog/codecov-is-updating-its-github-integration/).",
"",
"[![Impacted file tree graph](https://app.codecov.io/gh/ThiagoCodecov/example-python/pull/15/graphs/tree.svg?width=650&height=150&src=pr&token=abcdefghij)](https://app.codecov.io/gh/ThiagoCodecov/example-python/pull/15?src=pr&el=tree)",
"",
Expand Down Expand Up @@ -556,7 +556,7 @@ async def test_notify_new_layout(
"> Comparison is base [(`4535be1`)](https://app.codecov.io/gh/ThiagoCodecov/example-python/commit/4535be18e90467d6d9a99c0ce651becec7f7eba6?el=desc) 50.00% compared to head [(`2e2600a`)](https://app.codecov.io/gh/ThiagoCodecov/example-python/pull/15?src=pr&el=desc) 60.00%.",
"> Report is 52 commits behind head on master.",
"",
":exclamation: Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please [install the Github App Integration](https://github.com/apps/codecov) for your organization. [Read more](https://about.codecov.io/blog/codecov-is-updating-its-github-integration/).",
":exclamation: Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please [install the GitHub App Integration](https://github.com/apps/codecov) for your organization. [Read more](https://about.codecov.io/blog/codecov-is-updating-its-github-integration/).",
"",
"<details><summary>Additional details and impacted files</summary>\n",
"",
Expand Down Expand Up @@ -631,7 +631,7 @@ async def test_notify_with_components(
"Patch coverage has no change and project coverage change: **`+10.00%`** :tada:",
"> Comparison is base [(`93189ce`)](https://app.codecov.io/gh/codecove2e/example-python/commit/93189ce50f224296d6412e2884b93dcc3c7c8654?el=desc) 50.00% compared to head [(`8589c19`)](https://app.codecov.io/gh/codecove2e/example-python/pull/4?src=pr&el=desc) 60.00%.",
"",
":exclamation: Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please [install the Github App Integration](https://github.com/apps/codecov) for your organization. [Read more](https://about.codecov.io/blog/codecov-is-updating-its-github-integration/).",
":exclamation: Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please [install the GitHub App Integration](https://github.com/apps/codecov) for your organization. [Read more](https://about.codecov.io/blog/codecov-is-updating-its-github-integration/).",
"",
"<details><summary>Additional details and impacted files</summary>\n",
"",
Expand Down
41 changes: 32 additions & 9 deletions services/notification/notifiers/tests/unit/test_comment.py
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ async def test__possibly_write_gh_app_login_announcement_should_add_announcement
fake_comparison, mock_write
)
mock_write.assert_any_call(
":exclamation: Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please [install the Github App Integration](https://github.com/apps/codecov) for your organization. [Read more](https://about.codecov.io/blog/codecov-is-updating-its-github-integration/).",
":exclamation: Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please [install the GitHub App Integration](https://github.com/apps/codecov) for your organization. [Read more](https://about.codecov.io/blog/codecov-is-updating-its-github-integration/).",
)
assert mock_write.call_count == 2

Expand Down Expand Up @@ -3778,8 +3778,8 @@ async def test_footer_section_writer_in_github(self, mocker):
mocker.MagicMock(),
mocker.MagicMock(),
mocker.MagicMock(),
mocker.MagicMock(),
mocker.MagicMock(),
settings={},
current_yaml=mocker.MagicMock(),
)
mock_comparison = mocker.MagicMock()
mock_comparison.repository_service.service = "github"
Expand All @@ -3800,8 +3800,8 @@ async def test_footer_section_writer_in_gitlab(self, mocker):
mocker.MagicMock(),
mocker.MagicMock(),
mocker.MagicMock(),
mocker.MagicMock(),
mocker.MagicMock(),
settings={},
current_yaml=mocker.MagicMock(),
)
mock_comparison = mocker.MagicMock()
mock_comparison.repository_service.service = "gitlab"
Expand All @@ -3822,8 +3822,8 @@ async def test_footer_section_writer_in_bitbucket(self, mocker):
mocker.MagicMock(),
mocker.MagicMock(),
mocker.MagicMock(),
mocker.MagicMock(),
mocker.MagicMock(),
settings={},
current_yaml=mocker.MagicMock(),
)
mock_comparison = mocker.MagicMock()
mock_comparison.repository_service.service = "bitbucket"
Expand All @@ -3838,6 +3838,30 @@ async def test_footer_section_writer_in_bitbucket(self, mocker):
":loudspeaker: Have feedback on the report? [Share it here](https://gitlab.com/codecov-open-source/codecov-user-feedback/-/issues/4).",
]

@pytest.mark.asyncio
async def test_footer_section_writer_with_project_cov_hidden(self, mocker):
writer = NewFooterSectionWriter(
mocker.MagicMock(),
mocker.MagicMock(),
mocker.MagicMock(),
settings={
"layout": "newheader, files, newfooter",
"hide_project_coverage": True,
},
current_yaml={},
)
mock_comparison = mocker.MagicMock()
mock_comparison.repository_service.service = "bitbucket"
res = list(
await writer.write_section(
mock_comparison, {}, [], links={"pull": "pull.link"}
)
)
assert res == [
"",
":loudspeaker: Thoughts on this report? [Let us know!](https://about.codecov.io/pull-request-comment-report/).",
]


class TestCommentNotifierInNewLayout(object):
@pytest.mark.asyncio
Expand Down Expand Up @@ -4168,8 +4192,7 @@ async def test_build_message_no_project_coverage(
f"| [file\\_1.go](test.example.br/gh/{repository.slug}/pull/{pull.pullid}?src=pr&el=tree#diff-ZmlsZV8xLmdv) | `66.67%` |",
f"",
f"",
f"[:umbrella: View full report in Codecov by Sentry](test.example.br/gh/{repository.slug}/pull/{pull.pullid}?src=pr&el=continue). ",
f":loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/).",
f":loudspeaker: Thoughts on this report? [Let us know!](https://about.codecov.io/pull-request-comment-report/).",
f"",
]
for exp, res in zip(expected_result, result):
Expand Down
2 changes: 1 addition & 1 deletion tasks/tests/integration/test_notify_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -1160,7 +1160,7 @@ async def test_simple_call_status_and_notifiers(
"",
"> :exclamation: Current head 610ada9 differs from pull request most recent head a2d3e3c. Consider uploading reports for the commit a2d3e3c to get more accurate results",
"",
":exclamation: Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please [install the Github App Integration](https://github.com/apps/codecov) for your organization. [Read more](https://about.codecov.io/blog/codecov-is-updating-its-github-integration/).",
":exclamation: Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please [install the GitHub App Integration](https://github.com/apps/codecov) for your organization. [Read more](https://about.codecov.io/blog/codecov-is-updating-its-github-integration/).",
"",
"[![Impacted file tree graph](https://myexamplewebsite.io/gh/test-acc9/test_example/pull/1/graphs/tree.svg?width=650&height=150&src=pr&token=abcdefghij)](https://myexamplewebsite.io/gh/test-acc9/test_example/pull/1?src=pr&el=tree)",
"",
Expand Down

0 comments on commit b76da11

Please sign in to comment.