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

Change default upper section from "header" to "condensed_header" #209

Merged
merged 3 commits into from
Dec 12, 2023
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
6 changes: 5 additions & 1 deletion conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,11 @@ def mock_smtp(mocker):
def mock_repo_provider(mocker):
m = mocker.patch("services.repository._get_repo_provider_service_instance")
provider_instance = mocker.MagicMock(
GithubHandler, get_commit_diff=mock.AsyncMock(return_value={})
GithubHandler,
get_commit_diff=mock.AsyncMock(return_value={}),
get_distance_in_commits=mock.AsyncMock(
return_value={"behind_by": 0, "behind_by_commit": None}
),
)
m.return_value = provider_instance
yield provider_instance
Expand Down
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 @@ -209,7 +209,7 @@ def get_upper_section_names(self, settings):
sections = list(map(lambda l: l.strip(), (settings["layout"] or "").split(",")))
headers = ["newheader", "header", "condensed_header"]
if all(not x in sections for x in headers):
sections.insert(0, "header")
sections.insert(0, "condensed_header")

return [
section
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -355,9 +355,9 @@ async def test_notify(self, sample_comparison, codecov_vcr, mock_configuration):
assert result.explanation is None
message = [
"## [Codecov](https://app.codecov.io/gh/joseph-sentry/codecov-demo/pull/9?src=pr&el=h1) Report",
"> Merging [#9](https://app.codecov.io/gh/joseph-sentry/codecov-demo/pull/9?src=pr&el=desc) (5601846) into [main](https://app.codecov.io/gh/joseph-sentry/codecov-demo/commit/5b174c2b40d501a70c479e91025d5109b1ad5c1b?el=desc) (5b174c2) will **increase** coverage by `10.00%`.",
"All modified and coverable lines are covered by tests :white_check_mark:",
"> Comparison is base [(`5b174c2`)](https://app.codecov.io/gh/joseph-sentry/codecov-demo/commit/5b174c2b40d501a70c479e91025d5109b1ad5c1b?el=desc) 50.00% compared to head [(`5601846`)](https://app.codecov.io/gh/joseph-sentry/codecov-demo/pull/9?src=pr&el=desc) 60.00%.",
"> Report is 2 commits behind head on main.",
"> The diff coverage is `n/a`.",
"",
":exclamation: Your organization needs to install the [Codecov GitHub app](https://github.com/apps/codecov/installations/select_target) to enable full functionality.",
"",
Expand Down Expand Up @@ -501,8 +501,8 @@ async def test_notify_gitlab(
assert result.explanation is None
message = [
"## [Codecov](https://app.codecov.io/gl/joseph-sentry/example-python/pull/1?src=pr&el=h1) Report",
"> Merging [#1](https://app.codecov.io/gl/joseph-sentry/example-python/pull/1?src=pr&el=desc) (0b6a213) into [main](https://app.codecov.io/gl/joseph-sentry/example-python/commit/0fc784af11c401449e56b24a174bae7b9af86c98?el=desc) (0fc784a) will **increase** coverage by `10.00%`.",
"> The diff coverage is `n/a`.",
"All modified and coverable lines are covered by tests :white_check_mark:",
"> Comparison is base [(`0fc784a`)](https://app.codecov.io/gl/joseph-sentry/example-python/commit/0fc784af11c401449e56b24a174bae7b9af86c98?el=desc) 50.00% compared to head [(`0b6a213`)](https://app.codecov.io/gl/joseph-sentry/example-python/pull/1?src=pr&el=desc) 60.00%.",
"",
"[![Impacted file tree graph](https://app.codecov.io/gl/joseph-sentry/example-python/pull/1/graphs/tree.svg?width=650&height=150&src=pr&token=abcdefghij)](https://app.codecov.io/gl/joseph-sentry/example-python/pull/1?src=pr&el=tree)",
"",
Expand Down
14 changes: 8 additions & 6 deletions services/notification/notifiers/tests/unit/test_checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -1507,8 +1507,9 @@ async def test_build_default_payload(
"text": "\n".join(
[
f"## [Codecov](test.example.br/gh/test_build_default_payload/{repo.name}/pull/{sample_comparison.pull.pullid}?src=pr&el=h1) Report",
f"> Merging [#{sample_comparison.pull.pullid}](test.example.br/gh/test_build_default_payload/{repo.name}/pull/{sample_comparison.pull.pullid}?src=pr&el=desc) ({head_commit.commitid[:7]}) into [master](test.example.br/gh/test_build_default_payload/{repo.name}/commit/{sample_comparison.base.commit.commitid}?el=desc) ({base_commit.commitid[:7]}) will **increase** coverage by `10.00%`.",
f"> The diff coverage is `66.67%`.",
"Attention: `1 lines` in your changes are missing coverage. Please review.",
f"> Comparison is base [(`{base_commit.commitid[:7]}`)](test.example.br/gh/test_build_default_payload/{repo.name}/commit/{base_commit.commitid}?el=desc) 50.00% compared to head [(`{head_commit.commitid[:7]}`)](test.example.br/gh/test_build_default_payload/{repo.name}/pull/{sample_comparison.pull.pullid}?src=pr&el=desc) 60.00%."
f"",
f"",
f"| [Files](test.example.br/gh/test_build_default_payload/{repo.name}/pull/{sample_comparison.pull.pullid}?src=pr&el=tree) | Coverage Δ | Complexity Δ | |",
f"|---|---|---|---|",
Expand Down Expand Up @@ -1549,8 +1550,9 @@ async def test_build_default_payload_with_flags(
"text": "\n".join(
[
f"## [Codecov](test.example.br/gh/test_build_default_payload_with_flags/{repo.name}/pull/{sample_comparison.pull.pullid}?src=pr&el=h1) Report",
f"> Merging [#{sample_comparison.pull.pullid}](test.example.br/gh/test_build_default_payload_with_flags/{repo.name}/pull/{sample_comparison.pull.pullid}?src=pr&el=desc) ({head_commit.commitid[:7]}) into [master](test.example.br/gh/test_build_default_payload_with_flags/{repo.name}/commit/{sample_comparison.base.commit.commitid}?el=desc) ({base_commit.commitid[:7]}) will **increase** coverage by `10.00%`.",
f"> The diff coverage is `66.67%`.",
"Attention: `1 lines` in your changes are missing coverage. Please review.",
f"> Comparison is base [(`{base_commit.commitid[:7]}`)](test.example.br/gh/test_build_default_payload_with_flags/{repo.name}/commit/{base_commit.commitid}?el=desc) 50.00% compared to head [(`{head_commit.commitid[:7]}`)](test.example.br/gh/test_build_default_payload_with_flags/{repo.name}/pull/{sample_comparison.pull.pullid}?src=pr&el=desc) 60.00%."
f"",
f"",
f"| [Files](test.example.br/gh/test_build_default_payload_with_flags/{repo.name}/pull/{sample_comparison.pull.pullid}?src=pr&el=tree) | Coverage Δ | Complexity Δ | |",
f"|---|---|---|---|",
Expand Down Expand Up @@ -1592,8 +1594,8 @@ async def test_build_default_payload_with_flags_and_footer(
"text": "\n".join(
[
f"## [Codecov](test.example.br/gh/{test_name}/{repo.name}/pull/{sample_comparison.pull.pullid}?src=pr&el=h1) Report",
f"> Merging [#{sample_comparison.pull.pullid}](test.example.br/gh/{test_name}/{repo.name}/pull/{sample_comparison.pull.pullid}?src=pr&el=desc) ({head_commit.commitid[:7]}) into [master](test.example.br/gh/{test_name}/{repo.name}/commit/{sample_comparison.base.commit.commitid}?el=desc) ({base_commit.commitid[:7]}) will **increase** coverage by `10.00%`.",
f"> The diff coverage is `66.67%`.",
"Attention: `1 lines` in your changes are missing coverage. Please review.",
f"> Comparison is base [(`{base_commit.commitid[:7]}`)](test.example.br/gh/test_build_default_payload_with_flags_and_footer/{repo.name}/commit/{base_commit.commitid}?el=desc) 50.00% compared to head [(`{head_commit.commitid[:7]}`)](test.example.br/gh/test_build_default_payload_with_flags_and_footer/{repo.name}/pull/{sample_comparison.pull.pullid}?src=pr&el=desc) 60.00%.",
f"",
f"| [Files](test.example.br/gh/{test_name}/{repo.name}/pull/{sample_comparison.pull.pullid}?src=pr&el=tree) | Coverage Δ | Complexity Δ | |",
f"|---|---|---|---|",
Expand Down
Loading