slpkg/tests/test_sbo_queries.py

62 lines
2 KiB
Python
Raw Normal View History

2022-06-21 19:46:20 +02:00
import unittest
2024-04-29 21:27:15 +02:00
2024-03-21 17:33:33 +01:00
from slpkg.load_data import LoadData
2022-06-21 19:46:20 +02:00
2024-04-29 21:27:15 +02:00
2022-06-21 19:46:20 +02:00
class TestSBoQueries(unittest.TestCase):
2024-05-21 21:01:26 +02:00
"""Test for SBo queries."""
2024-04-29 21:27:15 +02:00
def setUp(self) -> None:
2024-05-22 18:22:47 +02:00
"""Set the test."""
2024-03-21 17:33:33 +01:00
load = LoadData()
self.data: dict = load.load('sbo')
2023-04-09 19:38:17 +02:00
self.name: str = 'slpkg'
2022-06-21 19:46:20 +02:00
2024-04-29 21:27:15 +02:00
def test_slackbuild(self) -> None:
2024-05-21 21:01:26 +02:00
"""Test package slackbuild."""
2024-04-29 21:27:15 +02:00
sbo_name: bool = True
self.assertTrue(sbo_name, self.data[self.name])
2022-06-21 19:46:20 +02:00
2024-04-29 21:27:15 +02:00
def test_location(self) -> None:
2024-05-21 21:01:26 +02:00
"""Test package location."""
2023-05-13 16:51:44 +02:00
self.assertEqual('system', self.data[self.name]['location'])
2022-06-21 19:46:20 +02:00
2024-04-29 21:27:15 +02:00
def test_sources_x86(self) -> None:
2024-05-21 21:01:26 +02:00
"""Test sources for x86 arch."""
2022-12-22 22:55:45 +01:00
self.assertEqual(['https://gitlab.com/dslackw/slpkg/-/archive'
2024-04-29 21:27:15 +02:00
'/4.9.8/slpkg-4.9.8.tar.gz'], self.data[self.name]['download'])
2023-04-09 19:38:17 +02:00
2024-04-29 21:27:15 +02:00
def test_sources_x86_64(self) -> None:
2024-05-22 18:22:47 +02:00
"""Test sources for x64 arch."""
2024-03-21 17:33:33 +01:00
self.assertEqual([], self.data[self.name]['download64'])
2022-06-21 19:46:20 +02:00
2024-04-29 21:27:15 +02:00
def test_requires(self) -> None:
2024-05-21 21:01:26 +02:00
"""Test for package requires."""
2024-04-02 20:53:47 +02:00
self.assertEqual(['python3-build', 'python3-pythondialog'],
2024-03-21 17:33:33 +01:00
self.data[self.name]['requires'])
2022-06-21 19:46:20 +02:00
2024-04-29 21:27:15 +02:00
def test_version(self) -> None:
2024-05-21 21:01:26 +02:00
"""Test for package version."""
2024-04-02 20:53:47 +02:00
self.assertEqual('5.0.4', self.data[self.name]['version'])
2023-04-09 19:38:17 +02:00
2024-04-29 21:27:15 +02:00
def test_checksum_x86(self) -> None:
2024-05-21 21:01:26 +02:00
"""Test package checksum for x86."""
2024-03-21 17:33:33 +01:00
self.assertListEqual(['9f9cf626d7246202886774c6cbc2cccf'], self.data[self.name]['md5sum'])
2022-06-21 19:46:20 +02:00
2024-04-29 21:27:15 +02:00
def test_checksum_x86_64(self) -> None:
2024-05-21 21:01:26 +02:00
"""Test package checksum for x64."""
2024-03-21 17:33:33 +01:00
self.assertListEqual([], self.data[self.name]['md5sum64'])
2022-06-21 19:46:20 +02:00
2024-04-29 21:27:15 +02:00
def test_files(self) -> None:
2024-05-21 21:01:26 +02:00
"""Test for package files."""
2024-03-21 17:33:33 +01:00
self.assertEqual(5, len(self.data[self.name]['files']))
2022-06-21 19:46:20 +02:00
2024-04-29 21:27:15 +02:00
def test_description(self) -> None:
2024-05-21 21:01:26 +02:00
"""Test for package description."""
2023-05-13 16:51:44 +02:00
self.assertEqual('slpkg (Slackware Packaging Tool)', self.data[self.name]['description'])
2022-06-21 19:46:20 +02:00
if __name__ == '__main__':
unittest.main()