slpkg/tests/test_bin_queries.py

71 lines
2.3 KiB
Python
Raw Permalink 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-05-21 21:01:26 +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-05-22 18:18:54 +02:00
"""Set the test."""
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:
2024-05-21 21:01:26 +02:00
"""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:
2024-05-21 21:01:26 +02:00
"""Test for package name."""
2024-04-29 20:59:53 +02:00
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:
2024-05-21 21:01:26 +02:00
"""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:
2024-05-21 21:01:26 +02:00
"""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:
2024-05-21 21:01:26 +02:00
"""Test for mirror."""
self.assertEqual('http://mirror.nl.leaseweb.net/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:
2024-05-21 21:01:26 +02:00
"""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:
2024-05-21 21:01:26 +02:00
"""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:
2024-05-21 21:01:26 +02:00
"""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:
2024-05-21 21:01:26 +02:00
"""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:
2024-05-21 21:01:26 +02:00
"""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:
2024-05-21 21:01:26 +02:00
"""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:
2024-05-21 21:01:26 +02:00
"""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:
2024-05-21 21:01:26 +02:00
"""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()