diff options
author | Jake Hunsaker <jhunsake@redhat.com> | 2022-06-21 14:43:30 -0400 |
---|---|---|
committer | Jake Hunsaker <jhunsake@redhat.com> | 2022-06-28 17:08:52 -0400 |
commit | dea4a481ea25e446272b8220f866aaa8ede1dcb8 (patch) | |
tree | 1d615a636d54ec21f50735de9d09b78ea343367b /tests/unittests | |
parent | 8c0f54c5c2b9f6b8315a8330e00c7e8b612e3d5f (diff) | |
download | sos-dea4a481ea25e446272b8220f866aaa8ede1dcb8.tar.gz |
[PackageManager] Make pkg_by_name() more predictable
As highlighted in #1817, `pkg_by_name()` could provide unpredictable
results, when using wildcards. As such, limited this method to only
returning package info for exact package name matches. In turn, change
`Plugin.is_installed()` to leverage `PackageManager.all_pkgs_by_name()`
which does explicitly support wildcards and returns information on _all_
matching packages, not just the last one found.
In so doing, clean up the `PackageManager` design to use a new
`packages` property for these lookups, and update the former usage of
`all_pkgs()` accordingly. Similarly, signal `get_pkg_list()` should be
private (in any sense that a python method can be) by renaming to
`_get_pkg_list()` and update the single Plugin (`etcd`) referencing this
method.
Closes: #1817
Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
Diffstat (limited to 'tests/unittests')
-rw-r--r-- | tests/unittests/policy_tests.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/tests/unittests/policy_tests.py b/tests/unittests/policy_tests.py index 6d0c42b9..81210815 100644 --- a/tests/unittests/policy_tests.py +++ b/tests/unittests/policy_tests.py @@ -84,7 +84,7 @@ class PackageManagerTests(unittest.TestCase): self.pm = PackageManager() def test_default_all_pkgs(self): - self.assertEquals(self.pm.all_pkgs(), {}) + self.assertEquals(self.pm.packages, {}) def test_default_all_pkgs_by_name(self): self.assertEquals(self.pm.all_pkgs_by_name('doesntmatter'), []) |