aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorLucio Sauer <watermanpaint@posteo.net>2024-07-20 17:02:16 +0200
committerArthur Zamarin <arthurzam@gentoo.org>2024-07-20 18:37:22 +0300
commit3a4a1f3b000d297f6bc9ab6b44e68d991e74b28c (patch)
treede731fe0130b3f2da6bdf30876c9f65d9233a0e9 /tests
parentpkgdev commit: add optional support for Closes tags with resolution (diff)
downloadpkgdev-3a4a1f3b000d297f6bc9ab6b44e68d991e74b28c.tar.gz
pkgdev-3a4a1f3b000d297f6bc9ab6b44e68d991e74b28c.tar.bz2
pkgdev-3a4a1f3b000d297f6bc9ab6b44e68d991e74b28c.zip
tests: add tests for Closes tags with resolution
Signed-off-by: Lucio Sauer <watermanpaint@posteo.net> Signed-off-by: Arthur Zamarin <arthurzam@gentoo.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/scripts/test_pkgdev_commit.py30
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/scripts/test_pkgdev_commit.py b/tests/scripts/test_pkgdev_commit.py
index ff93db8..04fc16a 100644
--- a/tests/scripts/test_pkgdev_commit.py
+++ b/tests/scripts/test_pkgdev_commit.py
@@ -152,6 +152,36 @@ class TestPkgdevCommitParseArgs:
options, _ = tool.parse_args(["commit", opt, "https://bugs.gentoo.org/2"])
assert options.footer == {("Closes", "https://bugs.gentoo.org/2")}
+ # bug IDs and URLs with good resolutions
+ for opt in ("-c", "--closes"):
+ for values, expected in (
+ (("", "FIXED", "fiXed"), ""),
+ (("PKGREMOVED", "pkgRemovEd"), " (pkgremoved)"),
+ (("OBSOLETE", "obSoleTe"), " (obsolete)"),
+ ):
+ for value in values:
+ for bug in "1", "https://bugs.gentoo.org/1":
+ options, _ = tool.parse_args(["commit", opt, f"{bug}:{value}"])
+ assert options.footer == {
+ ("Closes", f"https://bugs.gentoo.org/1{expected}")
+ }
+
+ # bad bug-resolution pair
+ for opt in ("-c", "--closes"):
+ for value, expected in (
+ (":", "invalid commit tag"),
+ (":1", "invalid commit tag"),
+ (":fixed", "invalid commit tag"),
+ ("1:invalid", "should be one of"),
+ ("https://bugs.gentoo.org/1:invalid", "should be one of"),
+ ):
+ with pytest.raises(SystemExit) as excinfo:
+ options, _ = tool.parse_args(["commit", opt, value])
+ assert excinfo.value.code == 2
+ out, err = capsys.readouterr()
+ assert not out
+ assert expected in err
+
# bad URL
for opt in ("-b", "-c"):
with pytest.raises(SystemExit) as excinfo: