Skip to content

Commit 76b7064

Browse files
committed
add missing coverage
1 parent 734f283 commit 76b7064

File tree

3 files changed

+22
-1
lines changed

3 files changed

+22
-1
lines changed

.generator/cli.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1230,7 +1230,9 @@ def _process_changelog(
12301230
if adjusted_change_type in change_type_map:
12311231
entry_parts.append(f"\n\n### {change_type_map[adjusted_change_type]}\n")
12321232
for change in library_changes:
1233-
commit_hash = change.get(source_commit_hash_key) or change.get(commit_hash_key)
1233+
commit_hash = change.get(source_commit_hash_key) or change.get(
1234+
commit_hash_key
1235+
)
12341236
commit_link = f"([{commit_hash}]({_REPO_URL}/commit/{commit_hash}))"
12351237
entry_parts.append(
12361238
f"* {change[subject_key]} {change[body_key]} {commit_link}"

.generator/parse_googleapis_content.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@
103103
"glob",
104104
)
105105

106+
106107
def parse_content(content: str) -> dict:
107108
"""Parses content from BUILD.bazel and returns a dictionary
108109
containing bazel rules and arguments.

.generator/test_cli.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -854,6 +854,24 @@ def test_handle_release_init_success(mocker, mock_release_init_request_file):
854854
handle_release_init()
855855

856856

857+
def test_handle_release_init_is_generated_success(
858+
mocker, mock_release_init_request_file
859+
):
860+
"""
861+
Tests that `handle_release_init` calls `_update_global_changelog` when the
862+
`packages` directory exists.
863+
"""
864+
mocker.patch("pathlib.Path.exists", return_value=True)
865+
mock_update_global_changelog = mocker.patch("cli._update_global_changelog")
866+
mocker.patch("cli._update_version_for_library")
867+
mocker.patch("cli._get_previous_version", return_value="1.2.2")
868+
mocker.patch("cli._update_changelog_for_library")
869+
870+
handle_release_init()
871+
872+
mock_update_global_changelog.assert_called_once()
873+
874+
857875
def test_handle_release_init_fail_value_error_file():
858876
"""
859877
Tests that handle_release_init fails to read `librarian/release-init-request.json`.

0 commit comments

Comments
 (0)