slpkg/tests/test_bin_queries.py

83 lines
2.4 KiB
Python
Raw Normal View History

2023-04-03 19:58:12 +02:00
import unittest
2024-03-21 17:33:33 +01:00
from slpkg.load_data import LoadData
2023-04-03 19:58:12 +02:00
class TestBinQueries(unittest.TestCase):
2024-04-29 20:59:53 +02:00
""" Test for binaries repository.
"""
2023-04-03 19:58:12 +02:00
2024-04-29 20:59:53 +02:00
def setUp(self) -> None:
2024-03-21 17:33:33 +01:00
load = LoadData()
self.repo_data = load.load('slack')
2023-04-03 19:58:12 +02:00
2024-04-29 20:59:53 +02:00
def test_repository_data(self) -> None:
""" Test repository data.
"""
2023-04-09 19:38:17 +02:00
self.assertGreater(len(list(self.repo_data.keys())), 1)
2023-04-03 19:58:12 +02:00
2024-04-29 20:59:53 +02:00
def test_package_name(self) -> None:
""" Test for package name.
"""
exist: bool = True
self.assertTrue(exist, self.repo_data.get('aaa_base'))
2023-04-03 19:58:12 +02:00
2024-04-29 20:59:53 +02:00
def test_version(self) -> None:
""" Test for package version.
"""
2023-05-13 16:51:44 +02:00
self.assertEqual('15.0', self.repo_data['aaa_base']['version'])
2023-04-09 19:38:17 +02:00
2024-04-29 20:59:53 +02:00
def test_package_bin(self) -> None:
""" Test for binary package.
"""
2023-05-13 16:51:44 +02:00
self.assertEqual('aaa_base-15.0-x86_64-3.txz', self.repo_data['aaa_base']['package'])
2023-04-03 19:58:12 +02:00
2024-04-29 20:59:53 +02:00
def test_mirror(self) -> None:
""" Test for mirror.
"""
2023-05-13 16:51:44 +02:00
self.assertEqual('https://slackware.uk/slackware/slackware64-15.0/', self.repo_data['aaa_base']['mirror'])
2023-04-03 19:58:12 +02:00
2024-04-29 20:59:53 +02:00
def test_location(self) -> None:
""" Test for location.
"""
2023-05-13 16:51:44 +02:00
self.assertEqual('slackware64/a', self.repo_data['aaa_base']['location'])
2023-04-03 19:58:12 +02:00
2024-04-29 20:59:53 +02:00
def test_size_comp(self) -> None:
""" Test for comp size.
"""
2023-05-13 16:51:44 +02:00
self.assertEqual('12', self.repo_data['aaa_base']['size_comp'])
2023-04-03 19:58:12 +02:00
2024-04-29 20:59:53 +02:00
def test_size_uncomp(self) -> None:
""" Test for uncomp size.
"""
2023-05-13 16:51:44 +02:00
self.assertEqual('90', self.repo_data['aaa_base']['size_uncomp'])
2023-04-03 19:58:12 +02:00
2024-04-29 20:59:53 +02:00
def test_required(self) -> None:
""" Test for requires.
"""
2024-03-21 17:33:33 +01:00
self.assertEqual([], self.repo_data['aaa_base']['requires'])
2023-04-03 19:58:12 +02:00
2024-04-29 20:59:53 +02:00
def test_conflicts(self) -> None:
""" Test for conflicts.
"""
2023-05-13 16:51:44 +02:00
self.assertEqual('', self.repo_data['aaa_base']['conflicts'])
2023-04-03 19:58:12 +02:00
2024-04-29 20:59:53 +02:00
def test_suggests(self) -> None:
""" Test for suggests.
"""
2023-05-13 16:51:44 +02:00
self.assertEqual('', self.repo_data['aaa_base']['suggests'])
2023-04-03 19:58:12 +02:00
2024-04-29 20:59:53 +02:00
def test_description(self) -> None:
""" Test for description.
"""
2023-05-13 16:51:44 +02:00
self.assertEqual('', self.repo_data['aaa_base']['description'])
2023-04-09 19:38:17 +02:00
2024-04-29 20:59:53 +02:00
def test_package_checksum(self) -> None:
""" Test for package checksum.
"""
2023-05-13 16:51:44 +02:00
self.assertEqual('ee674755e75a3f9cb3c7cfc0039f376d', self.repo_data['aaa_base']['checksum'])
2023-04-03 19:58:12 +02:00
if __name__ == '__main__':
unittest.main()