|
23 | 23 | success_case = {
|
24 | 24 | "get_github_repository": "owner/repo_name",
|
25 | 25 | "get_tag_name": "tag_name",
|
| 26 | + "get_from_tag_name": "from_tag_name", |
26 | 27 | "get_chapters_json": '{"chapter": "content"}',
|
27 | 28 | "get_duplicity_scope": "custom",
|
28 | 29 | "get_duplicity_icon": "🔁",
|
|
31 | 32 | "get_skip_release_notes_labels": ["skip"],
|
32 | 33 | "get_print_empty_chapters": True,
|
33 | 34 | "get_verbose": True,
|
| 35 | + "get_release_notes_title": "Success value", |
34 | 36 | }
|
35 | 37 |
|
36 | 38 | failure_cases = [
|
37 | 39 | ("get_github_repository", "", "Owner and Repo must be a non-empty string."),
|
38 | 40 | ("get_github_repository", "owner/", "Owner and Repo must be a non-empty string."),
|
39 | 41 | ("get_tag_name", "", "Tag name must be a non-empty string."),
|
| 42 | + ("get_from_tag_name", 1, "From tag name must be a string."), |
40 | 43 | ("get_chapters_json", "invalid_json", "Chapters JSON must be a valid JSON string."),
|
41 | 44 | ("get_warnings", "not_bool", "Warnings must be a boolean."),
|
42 | 45 | ("get_published_at", "not_bool", "Published at must be a boolean."),
|
|
46 | 49 | ("get_duplicity_icon", "Oj", "Duplicity icon must be a non-empty string and have a length of 1."),
|
47 | 50 | ("get_row_format_issue", "", "Issue row format must be a non-empty string."),
|
48 | 51 | ("get_row_format_pr", "", "PR Row format must be a non-empty string."),
|
| 52 | + ("get_release_notes_title", "", "Release Notes title must be a non-empty string and have non-zero length."), |
49 | 53 | ]
|
50 | 54 |
|
51 | 55 |
|
@@ -123,14 +127,21 @@ def test_get_skip_release_notes_label(mocker):
|
123 | 127 | mocker.patch("release_notes_generator.action_inputs.get_action_input", return_value="skip-release-notes")
|
124 | 128 | assert ActionInputs.get_skip_release_notes_labels() == ["skip-release-notes"]
|
125 | 129 |
|
| 130 | + |
| 131 | +def test_get_skip_release_notes_label_not_defined(mocker): |
| 132 | + mocker.patch("release_notes_generator.action_inputs.get_action_input", return_value="") |
| 133 | + assert ActionInputs.get_skip_release_notes_labels() == ["skip-release-notes"] |
| 134 | + |
126 | 135 | def test_get_skip_release_notes_labels(mocker):
|
127 | 136 | mocker.patch("release_notes_generator.action_inputs.get_action_input", return_value="skip-release-notes, another-skip-label")
|
128 | 137 | assert ActionInputs.get_skip_release_notes_labels() == ["skip-release-notes", "another-skip-label"]
|
129 | 138 |
|
| 139 | + |
130 | 140 | def test_get_skip_release_notes_labels_no_space(mocker):
|
131 | 141 | mocker.patch("release_notes_generator.action_inputs.get_action_input", return_value="skip-release-notes,another-skip-label")
|
132 | 142 | assert ActionInputs.get_skip_release_notes_labels() == ["skip-release-notes", "another-skip-label"]
|
133 | 143 |
|
| 144 | + |
134 | 145 | def test_get_print_empty_chapters(mocker):
|
135 | 146 | mocker.patch("release_notes_generator.action_inputs.get_action_input", return_value="true")
|
136 | 147 | assert ActionInputs.get_print_empty_chapters() is True
|
@@ -200,3 +211,11 @@ def test_clean_row_format_invalid_keywords_nested_braces():
|
200 | 211 | actual_format = ActionInputs._detect_row_format_invalid_keywords(row_format, clean=True)
|
201 | 212 | assert expected_format == actual_format
|
202 | 213 |
|
| 214 | + |
| 215 | +def test_release_notes_title_default(): |
| 216 | + assert ActionInputs.get_release_notes_title() == "[Rr]elease [Nn]otes:" |
| 217 | + |
| 218 | + |
| 219 | +def test_release_notes_title_custom(mocker): |
| 220 | + mocker.patch("release_notes_generator.action_inputs.get_action_input", return_value="Custom Title") |
| 221 | + assert ActionInputs.get_release_notes_title() == "Custom Title" |
0 commit comments