Skip to content

Commit 746ade5

Browse files
committed
Add changed unit tests to verify proper handling of GitHub releases
Signed-off-by: Tobias Wolf <wolf@b1-systems.de> On-behalf-of: SAP <tobias.wolf@sap.com>
1 parent 2352ee1 commit 746ade5

File tree

1 file changed

+38
-8
lines changed

1 file changed

+38
-8
lines changed

tests/github/test_create_github_release_notes.py

Lines changed: 38 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,25 @@ def test_release_notes_changes_section_broken_glvd_response() -> None:
5959
def test_release_notes_compare_package_versions_section_legacy_versioning_is_recognized() -> (
6060
None
6161
):
62-
assert (
63-
"Full List of Packages in Garden Linux version 1.0"
64-
in release_notes_compare_package_versions_section("1.0", {})
65-
), "Legacy versioning is supported"
62+
with requests_mock.Mocker() as m:
63+
m.get(
64+
f"{GLVD_BASE_URL}/releaseNotes/1.0",
65+
json={
66+
"packageList": [
67+
{
68+
"sourcePackageName": "gardenlinux-release-example",
69+
"oldVersion": "0.9pre1",
70+
"newVersion": "1.0",
71+
"fixedCves": [],
72+
}
73+
]
74+
},
75+
status_code=200,
76+
)
77+
78+
assert "upgrade 'gardenlinux-release-example'" in release_notes_changes_section(
79+
"1.0"
80+
), "Legacy versioning is supported"
6681

6782

6883
def test_release_notes_compare_package_versions_section_legacy_versioning_patch_release_is_recognized(
@@ -87,10 +102,25 @@ def mock_compare_apt_repo_versions(
87102

88103

89104
def test_release_notes_compare_package_versions_section_semver_is_recognized() -> None:
90-
assert (
91-
"Full List of Packages in Garden Linux version 1.20.0"
92-
in release_notes_compare_package_versions_section("1.20.0", {})
93-
), "Semver is supported"
105+
with requests_mock.Mocker() as m:
106+
m.get(
107+
f"{GLVD_BASE_URL}/releaseNotes/1.20.0",
108+
json={
109+
"packageList": [
110+
{
111+
"sourcePackageName": "gardenlinux-release-example",
112+
"oldVersion": "1.19.0",
113+
"newVersion": "1.20.0",
114+
"fixedCves": [],
115+
}
116+
]
117+
},
118+
status_code=200,
119+
)
120+
121+
assert "upgrade 'gardenlinux-release-example'" in release_notes_changes_section(
122+
"1.20.0"
123+
), "Semver is supported"
94124

95125

96126
def test_release_notes_compare_package_versions_section_semver_patch_release_is_recognized(

0 commit comments

Comments
 (0)