From 672736c84064517797c2f51be381da2fe96df58c Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Tue, 26 Apr 2022 17:16:48 +0300 Subject: [PATCH] Added split package unittest Signed-off-by: Dimitris Zlatanidis --- tests/test_split_package.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 tests/test_split_package.py diff --git a/tests/test_split_package.py b/tests/test_split_package.py new file mode 100644 index 00000000..aac0aa4d --- /dev/null +++ b/tests/test_split_package.py @@ -0,0 +1,26 @@ +import unittest +from slpkg.splitting import split_package +from slpkg.pkg.find import searching + + +class TestSplitting(unittest.TestCase): + + def test_split_pkg(self): + path = '/var/log/packages/' + pkg_1 = ''.join(list(searching('slpkg', path))) + pkg_2 = ''.join(list(searching('akonadi-mime', path))) + pkg_3 = ''.join(list(searching('autoconf-archive', path))) + pkg_4 = ''.join(list(searching('bind', path))) + + self.assertListEqual(['slpkg', '3.9.6', 'x86_64', '1'], + split_package(pkg_1)) + self.assertListEqual(['akonadi-mime', '21.12.1', 'x86_64', '1'], + split_package(pkg_2)) + self.assertListEqual(['autoconf-archive', '2021.02.19', 'noarch', '1'], + split_package(pkg_3)) + self.assertListEqual(['bind', '9.16.27', 'x86_64', '1'], + split_package(pkg_4)) + + +if __name__ == "__main__": + unittest.main()