Update PackageManager method names

This commit is contained in:
Eric Torres 2019-03-31 11:16:56 -07:00
parent 054f7a8a8e
commit 77b810b5a6
2 changed files with 4 additions and 8 deletions

View File

@ -43,11 +43,7 @@ class PackageManager:
self._db_path = Path(db_path)
self._pkglist_cmd = pkglist_cmd
def __init_subclass__(cls, cachedir, db_path, pkglist_cmd):
"""Default constructor for all child classes."""
super().__init_subclass(cachedir, db_path, pkglist_cmd)
def _gen_pkglist(self):
def gen_pkglist(self):
"""Generate a text file listing installed packages
on the system and return the path to that file.
@ -74,7 +70,7 @@ class PackageManager:
syslog.info("Package list generation complete")
return Path(pkglist.name)
def _gen_db_archive(self, *args, **kwargs):
def gen_db_archive(self, compress=None):
"""Generate a database archive for this package manager.
Note that this method is internal and is

View File

@ -102,7 +102,7 @@ class TestPackageManagerMethods(unittest.TestCase):
self.mocked_run.return_value.stdout = "packages"
self.mocked_tempfile.return_value.name = "tempfile"
pkglist = self.p._gen_pkglist()
pkglist = self.p.gen_pkglist()
self.mocked_tempfile.return_value.__enter__.return_value.write.assert_called_with(
"packages"
@ -112,7 +112,7 @@ class TestPackageManagerMethods(unittest.TestCase):
def test_pkglist_subprocess_error(self):
self.mocked_run.side_effect = subprocess.CalledProcessError(1, self.pkglist_cmd)
self.p._gen_pkglist()
self.p.gen_pkglist()
self.mocked_tempfile.assert_not_called()
def test_db_archive(self):