aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam James <sam@gentoo.org>2023-11-11 03:29:17 +0000
committerSam James <sam@gentoo.org>2023-11-11 07:23:08 +0000
commit00ce1c2e21575c6154ce22d0fcf676e2654c56b3 (patch)
tree12f8cbfdfdb363548deacd618fdbd006ff2925e6
parent_emerge: fix _eval_visiblity typo (diff)
downloadportage-00ce1c2e21575c6154ce22d0fcf676e2654c56b3.tar.gz
portage-00ce1c2e21575c6154ce22d0fcf676e2654c56b3.tar.bz2
portage-00ce1c2e21575c6154ce22d0fcf676e2654c56b3.zip
tests: test_bintree: add test for trust helper --pretend issue
Followup to 6ae45739e208b7a9d59e0b6056be72a5791aae04. Bug: https://bugs.gentoo.org/915842 Signed-off-by: Sam James <sam@gentoo.org>
-rw-r--r--lib/portage/tests/dbapi/test_bintree.py45
1 files changed, 45 insertions, 0 deletions
diff --git a/lib/portage/tests/dbapi/test_bintree.py b/lib/portage/tests/dbapi/test_bintree.py
index 0aa411ad9..018f1cf9b 100644
--- a/lib/portage/tests/dbapi/test_bintree.py
+++ b/lib/portage/tests/dbapi/test_bintree.py
@@ -3,6 +3,7 @@
from unittest.mock import MagicMock, patch, call
import os
+import tempfile
from portage.tests import TestCase
@@ -164,3 +165,47 @@ class BinarytreeTestCase(TestCase):
bt = binarytree(pkgdir=os.getenv("TMPDIR", "/tmp"), settings=settings)
bt.populate(getbinpkgs=True)
ppopulate_remote.assert_called_once_with(getbinpkg_refresh=False, pretend=False)
+
+ @patch("portage.dbapi.bintree.BinRepoConfigLoader")
+ @patch("portage.dbapi.bintree.binarytree._run_trust_helper")
+ def test_default_getbinpkg_refresh_in_populate_trusthelper(
+ self, run_trust_helper, pBinRepoConfigLoader
+ ):
+ """
+ Test for bug #915842.
+
+ Verify that we call the trust helper in non-pretend mode.
+ """
+ settings = MagicMock()
+ settings.features = ["binpkg-request-signature"]
+ settings.__getitem__.return_value = "/some/path"
+
+ d = tempfile.TemporaryDirectory()
+ try:
+ bt = binarytree(pkgdir=d.name, settings=settings)
+ bt.populate(getbinpkgs=True, pretend=False)
+ run_trust_helper.assert_called_once()
+ finally:
+ d.cleanup()
+
+ @patch("portage.dbapi.bintree.BinRepoConfigLoader")
+ @patch("portage.dbapi.bintree.binarytree._run_trust_helper")
+ def test_default_getbinpkg_refresh_in_populate_trusthelper_pretend(
+ self, run_trust_helper, pBinRepoConfigLoader
+ ):
+ """
+ Test for bug #915842.
+
+ Verify we do not call the trust helper in pretend mode.
+ """
+ settings = MagicMock()
+ settings.features = ["binpkg-request-signature"]
+ settings.__getitem__.return_value = "/some/path"
+
+ d = tempfile.TemporaryDirectory()
+ try:
+ bt = binarytree(pkgdir=d.name, settings=settings)
+ bt.populate(getbinpkgs=True, pretend=True)
+ run_trust_helper.assert_not_called()
+ finally:
+ d.cleanup()