From d9c08f1230d723d3dcf40fb1ae2fea46a0e4e332 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Mon, 3 Apr 2023 20:58:12 +0300 Subject: [PATCH] Added test for bin queries --- tests/test_bin_queries.py | 68 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 tests/test_bin_queries.py diff --git a/tests/test_bin_queries.py b/tests/test_bin_queries.py new file mode 100644 index 00000000..acb16d80 --- /dev/null +++ b/tests/test_bin_queries.py @@ -0,0 +1,68 @@ +import unittest +from slpkg.binaries.queries import BinQueries + + +class TestBinQueries(unittest.TestCase): + + def setUp(self): + self.query = BinQueries('aaa_base', 'slack') + + def test_count_packages(self): + self.assertGreater(self.query.count_packages(), 1) + + def test_all_package_names_by_repo(self): + self.assertGreater(len(self.query.all_package_names_by_repo()), 1) + + def test_all_binaries_packages_by_repo(self): + self.assertGreater(len(self.query.all_binaries_packages_by_repo()), 1) + + def test_all_package_names_from_repositories(self): + self.assertGreater(len(self.query.all_package_names_from_repositories()), 1) + + def test_all_package_names_with_required(self): + self.assertGreater(len(self.query.all_package_names_with_required()), 1) + + def test_repository(self): + self.assertEqual('slack', self.query.repository()) + + def test_package_name(self): + self.assertEqual('aaa_base', self.query.package_name()) + + def test_package_bin(self): + self.assertEqual('aaa_base-15.0-x86_64-3.txz', self.query.package_bin()) + + def test_package_checksum(self): + self.assertEqual('ee674755e75a3f9cb3c7cfc0039f376d', self.query.package_checksum()) + + def test_version(self): + self.assertEqual('15.0', self.query.version()) + + def test_mirror(self): + self.assertEqual('https://slackware.uk/slackware/slackware64-15.0/', self.query.mirror()) + + def test_location(self): + self.assertEqual('slackware64/a', self.query.location()) + + def test_size_comp(self): + self.assertEqual('12 KB', self.query.size_comp()) + + def test_size_uncomp(self): + self.assertEqual('90 KB', self.query.size_uncomp()) + + def test_required(self): + self.assertEqual(['jack2', 'ladspa_sdk', 'libsbsms', 'lilv', 'lv2', 'portaudio', 'portmidi', 'portsmf', 'serd', + 'sord', 'soundtouch', 'soxr', 'sratom', 'suil', 'twolame', 'vamp-plugin-sdk', 'wxGTK3'], + BinQueries('audacity', 'alien').required()) + + def test_conflicts(self): + self.assertEqual('', self.query.conflicts()) + + def test_suggests(self): + self.assertEqual('', self.query.suggests()) + + def test_description(self): + self.assertEqual('', self.query.description()) + + +if __name__ == '__main__': + unittest.main()