diff options
author | 2023-12-25 16:30:13 -0800 | |
---|---|---|
committer | 2023-12-25 16:30:13 -0800 | |
commit | 988e3da5fdb614dc3e2a6c7989e8b8c823bd40d4 (patch) | |
tree | 11891814b2686f1dab4e7a691b228d8edccf50dd | |
parent | models/glsa: catch another edge case in mail table generation (diff) | |
download | glsamaker-988e3da5fdb614dc3e2a6c7989e8b8c823bd40d4.tar.gz glsamaker-988e3da5fdb614dc3e2a6c7989e8b8c823bd40d4.tar.bz2 glsamaker-988e3da5fdb614dc3e2a6c7989e8b8c823bd40d4.zip |
autoglsa: add newlines between multiple packages' resolutions
Signed-off-by: John Helmert III <ajak@gentoo.org>
-rw-r--r-- | glsamaker/autoglsa.py | 4 | ||||
-rw-r--r-- | test/test_autoglsa.py | 35 |
2 files changed, 37 insertions, 2 deletions
diff --git a/glsamaker/autoglsa.py b/glsamaker/autoglsa.py index 06d2b40..e2b3aa4 100644 --- a/glsamaker/autoglsa.py +++ b/glsamaker/autoglsa.py @@ -28,7 +28,7 @@ RESOLUTION = ( "All {} users should upgrade to the latest version:\n" "\n" "# emerge --sync\n" - '# emerge --ask --oneshot --verbose "{}"' + '# emerge --ask --oneshot --verbose "{}"\n\n' ) IMPACT = "Please review the referenced CVE identifiers for details." @@ -236,7 +236,7 @@ def generate_resolution(glsa: GLSA, proper_name: str) -> str: resolution = "" for x in glsa.get_unaffected(): resolution += RESOLUTION.format(proper_name, x.versioned_atom()) - return resolution + return resolution.strip() def autogenerate_glsa(bugs: list[BugzillaBug]) -> Tuple[GLSA, list[NoAtomInSummary]]: diff --git a/test/test_autoglsa.py b/test/test_autoglsa.py index f032e52..7468547 100644 --- a/test/test_autoglsa.py +++ b/test/test_autoglsa.py @@ -154,6 +154,41 @@ def test_generate_resolution(app, db): """.strip() ) + with app.app_context(): + glsa.affected = [ + Affected( + "www-client/firefox", + "104.0", + Affected.range_types[">="], + "*", + "rapid", + "unaffected", + ), + Affected( + "www-client/firefox-bin", + "104.0", + Affected.range_types[">="], + "*", + "rapid", + "unaffected", + ), + ] + output = generate_resolution(glsa, "Mozilla Firefox") + + assert ( + output + == """All Mozilla Firefox users should upgrade to the latest version: + +# emerge --sync +# emerge --ask --oneshot --verbose ">=www-client/firefox-104.0:rapid" + +All Mozilla Firefox users should upgrade to the latest version: + +# emerge --sync +# emerge --ask --oneshot --verbose ">=www-client/firefox-bin-104.0:rapid" +""".strip() + ) + def test_autogenerate_glsa(app, db): bug = Mock() |