mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2024-12-27 09:58:10 +01:00
Updated for tests
This commit is contained in:
parent
01823f10a2
commit
381b6fedeb
6 changed files with 30 additions and 36 deletions
|
@ -15,8 +15,8 @@ class Check:
|
|||
local_size: int = 0
|
||||
for name, data in self.repositories.items():
|
||||
|
||||
local_chg_txt: Path = Path(data[1], 'ChangeLog.txt')
|
||||
repo_chg_txt: str = f'{data[2][0]}ChangeLog.txt'
|
||||
local_chg_txt: Path = Path(data['path'], 'ChangeLog.txt')
|
||||
repo_chg_txt: str = f"{data['mirror'][0]}ChangeLog.txt"
|
||||
|
||||
http = PoolManager()
|
||||
repo = http.request('GET', repo_chg_txt)
|
||||
|
|
|
@ -7,49 +7,45 @@ class TestBinQueries(unittest.TestCase):
|
|||
def setUp(self):
|
||||
self.bin_queries = BinQueries('slack')
|
||||
self.repo_data = self.bin_queries.repository_data()
|
||||
self.repos_data = self.bin_queries.repositories_data()
|
||||
|
||||
def test_repository_data(self):
|
||||
self.assertGreater(len(list(self.repo_data.keys())), 1)
|
||||
|
||||
def test_repositories_data(self):
|
||||
self.assertGreater(len(list(self.repos_data.keys())), 1)
|
||||
|
||||
def test_package_name(self):
|
||||
self.assertTrue(True, self.repo_data.get('aaa_base'))
|
||||
|
||||
def test_version(self):
|
||||
self.assertEqual('15.0', self.repo_data['aaa_base'][0])
|
||||
self.assertEqual('15.0', self.repo_data['aaa_base']['version'])
|
||||
|
||||
def test_package_bin(self):
|
||||
self.assertEqual('aaa_base-15.0-x86_64-3.txz', self.repo_data['aaa_base'][1])
|
||||
self.assertEqual('aaa_base-15.0-x86_64-3.txz', self.repo_data['aaa_base']['package'])
|
||||
|
||||
def test_mirror(self):
|
||||
self.assertEqual('https://slackware.uk/slackware/slackware64-15.0/', self.repo_data['aaa_base'][2])
|
||||
self.assertEqual('https://slackware.uk/slackware/slackware64-15.0/', self.repo_data['aaa_base']['mirror'])
|
||||
|
||||
def test_location(self):
|
||||
self.assertEqual('slackware64/a', self.repo_data['aaa_base'][3])
|
||||
self.assertEqual('slackware64/a', self.repo_data['aaa_base']['location'])
|
||||
|
||||
def test_size_comp(self):
|
||||
self.assertEqual('12 KB', self.repo_data['aaa_base'][4])
|
||||
self.assertEqual('12', self.repo_data['aaa_base']['size_comp'])
|
||||
|
||||
def test_size_uncomp(self):
|
||||
self.assertEqual('90 KB', self.repo_data['aaa_base'][5])
|
||||
self.assertEqual('90', self.repo_data['aaa_base']['size_uncomp'])
|
||||
|
||||
def test_required(self):
|
||||
self.assertEqual('', self.repo_data['aaa_base'][6])
|
||||
self.assertEqual('', self.repo_data['aaa_base']['requires'])
|
||||
|
||||
def test_conflicts(self):
|
||||
self.assertEqual('', self.repo_data['aaa_base'][7])
|
||||
self.assertEqual('', self.repo_data['aaa_base']['conflicts'])
|
||||
|
||||
def test_suggests(self):
|
||||
self.assertEqual('', self.repo_data['aaa_base'][8])
|
||||
self.assertEqual('', self.repo_data['aaa_base']['suggests'])
|
||||
|
||||
def test_description(self):
|
||||
self.assertEqual('', self.repo_data['aaa_base'][9])
|
||||
self.assertEqual('', self.repo_data['aaa_base']['description'])
|
||||
|
||||
def test_package_checksum(self):
|
||||
self.assertEqual('ee674755e75a3f9cb3c7cfc0039f376d', self.repo_data['aaa_base'][10])
|
||||
self.assertEqual('ee674755e75a3f9cb3c7cfc0039f376d', self.repo_data['aaa_base']['checksum'])
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
import unittest
|
||||
from slpkg.checks import Check
|
||||
from slpkg.binaries.queries import BinQueries
|
||||
from slpkg.sbos.queries import SBoQueries
|
||||
|
||||
|
||||
class TestPkgInstalled(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
self.bin_queries = BinQueries('alien')
|
||||
self.bin_queries = SBoQueries('sbo')
|
||||
self.data = self.bin_queries.repository_data()
|
||||
self.check = Check('aline', self.data)
|
||||
self.packages = ['audacity', 'vlc', 'dnspython']
|
||||
self.check = Check('sbo', self.data)
|
||||
self.packages = ['audacity', 'Flask', 'awscli']
|
||||
|
||||
def test_check_exists(self):
|
||||
self.assertIsNone(self.check.package_exists_in_the_database(self.packages))
|
||||
|
@ -18,7 +18,7 @@ class TestPkgInstalled(unittest.TestCase):
|
|||
self.assertIsNone(self.check.is_package_unsupported(self.packages))
|
||||
|
||||
def test_check_is_installed(self):
|
||||
self.assertIsNone(self.check.is_package_unsupported(self.packages))
|
||||
self.assertIsNone(self.check.is_package_installed(self.packages))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
|
|
@ -13,32 +13,33 @@ class TestSBoQueries(unittest.TestCase):
|
|||
self.assertTrue(True, self.data[self.name])
|
||||
|
||||
def test_location(self):
|
||||
self.assertEqual('system', self.data[self.name][0])
|
||||
self.assertEqual('system', self.data[self.name]['location'])
|
||||
|
||||
def test_sources_x86(self):
|
||||
self.assertEqual(['https://gitlab.com/dslackw/slpkg/-/archive'
|
||||
'/4.8.0/slpkg-4.8.0.tar.gz'], self.data[self.name][3].split())
|
||||
'/4.8.2/slpkg-4.8.2.tar.gz'], self.data[self.name]['download'].split())
|
||||
|
||||
def test_sources_x86_64(self):
|
||||
self.assertEqual([], self.data[self.name][4].split())
|
||||
self.assertEqual([], self.data[self.name]['download64'].split())
|
||||
|
||||
def test_requires(self):
|
||||
self.assertEqual(['SQLAlchemy', 'python3-pythondialog', 'python3-progress'], self.data[self.name][7].split())
|
||||
self.assertEqual(['SQLAlchemy', 'python3-pythondialog', 'python3-progress'],
|
||||
self.data[self.name]['requires'].split())
|
||||
|
||||
def test_version(self):
|
||||
self.assertEqual('4.8.0', self.data[self.name][2])
|
||||
self.assertEqual('4.8.2', self.data[self.name]['version'])
|
||||
|
||||
def test_checksum_x86(self):
|
||||
self.assertListEqual(['75af7a43379407b8428dc6053fac470c'], self.data[self.name][5].split())
|
||||
self.assertListEqual(['96197dd92a2cc70e163eacdf83909252'], self.data[self.name]['md5sum'].split())
|
||||
|
||||
def test_checksum_x86_64(self):
|
||||
self.assertListEqual([], self.data[self.name][6].split())
|
||||
self.assertListEqual([], self.data[self.name]['md5sum64'].split())
|
||||
|
||||
def test_files(self):
|
||||
self.assertEqual(5, len(self.data[self.name][1].split()))
|
||||
self.assertEqual(5, len(self.data[self.name]['files'].split()))
|
||||
|
||||
def test_description(self):
|
||||
self.assertEqual('slpkg (Slackware Packaging Tool)', self.data[self.name][8])
|
||||
self.assertEqual('slpkg (Slackware Packaging Tool)', self.data[self.name]['description'])
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
|
|
@ -15,7 +15,6 @@ class TestUtilities(unittest.TestCase):
|
|||
|
||||
def test_installed_is_upgradable_for_sbo_repository(self):
|
||||
packages: list = ['sbo-create', 'ptpython', 'pycharm', 'powerline-status']
|
||||
|
||||
for pkg in packages:
|
||||
self.assertFalse(False, Upgrade('sbo', self.data).is_package_upgradeable(pkg))
|
||||
|
||||
|
@ -24,7 +23,6 @@ class TestUtilities(unittest.TestCase):
|
|||
bin_queries = BinQueries(repo)
|
||||
data: dict = bin_queries.repository_data()
|
||||
packages: list = ['vim', 'httpd', 'seamonkey', 'sudo', 'python3', 'qt5', 'php']
|
||||
|
||||
for pkg in packages:
|
||||
self.assertFalse(False, Upgrade('slack', data).is_package_upgradeable(pkg))
|
||||
|
||||
|
@ -33,7 +31,6 @@ class TestUtilities(unittest.TestCase):
|
|||
bin_queries = BinQueries(repo)
|
||||
data: dict = bin_queries.repository_data()
|
||||
packages: list = ['audacity', 'vlc', 'dnspython']
|
||||
|
||||
for pkg in packages:
|
||||
self.assertFalse(False, Upgrade('alien', data).is_package_upgradeable(pkg))
|
||||
|
||||
|
|
|
@ -38,11 +38,11 @@ class TestUtilities(unittest.TestCase):
|
|||
self.assertIn(self.package, self.utils.installed_packages.values())
|
||||
|
||||
def test_read_build_tag(self):
|
||||
self.assertEqual('1', self.utils.read_slackbuild_build_tag('slpkg', 'system', self.repository))
|
||||
self.assertEqual('1', self.utils.read_slackbuild_build_tag('slpkg', 'system', 'sbo'))
|
||||
|
||||
def test_is_option(self):
|
||||
self.assertTrue(True, self.utils.is_option(['-P', '--parallel'],
|
||||
['-k', '-p', '-P', '--parallel', '--bin-repo']))
|
||||
['-k', '-p', '-P', '--parallel', '--repository']))
|
||||
|
||||
def test_get_file_size(self):
|
||||
self.assertEqual('2 MB', self.utils.get_file_size(Path('/var/log/packages/', self.package)))
|
||||
|
|
Loading…
Reference in a new issue