From 36239ee7b2d3ed3b4be90c58b634aa6d77530adc Mon Sep 17 00:00:00 2001 From: Bernhard Suttner Date: Thu, 1 Aug 2024 13:25:28 +0200 Subject: [PATCH] WIP: fix repolib tests for apt. mock apt --- test/test_repolib.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/test/test_repolib.py b/test/test_repolib.py index f338632a44..e4c125b514 100644 --- a/test/test_repolib.py +++ b/test/test_repolib.py @@ -29,9 +29,10 @@ # repofile must be patched and reloaded to import AptRepofile, otherwise # the class is not defined in the first place -deb_mock = MagicMock() +deb_mock, apt_mock = MagicMock() deb_mock.Deb822 = dict -with patch.dict("rhsm.repofile.sys.modules", {"debian.deb822": deb_mock}): +apt_mock.Cache = dict +with patch.dict("rhsm.repofile.sys.modules", {"debian.deb822": deb_mock, "apt": apt_mock}): reload(repofile) from rhsm.repofile import AptRepoFile reload(repofile) @@ -908,7 +909,7 @@ def test_releasever_the_string_none(self): class AptRepoFileTest(unittest.TestCase): def _helper_stub_repo(self, *args, **kwargs): - with patch("rhsm.repofile.apt", True): + with patch("rhsm.repofile.apt", dict): repo = Repo(*args, **kwargs) return repo