[arch-projects] [pyalpm][PATCH add tests] 3/4] tests: Add tests for pyalpm.handle
Add a few simple tests for functions which do not touch the local db. Signed-off-by: Jelle van der Waa <jelle@vdwaa.nl> --- tests/test_handle.py | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 tests/test_handle.py diff --git a/tests/test_handle.py b/tests/test_handle.py new file mode 100644 index 0000000..03cd704 --- /dev/null +++ b/tests/test_handle.py @@ -0,0 +1,45 @@ +import unittest +import pyalpm + + +class handle(unittest.TestCase): + + def setUp(self): + self.handle = pyalpm.Handle('/', '/var/lib/pacman') + + def test_cachedirs(self): + self.handle.add_cachedir('/tmp/') + self.assertIn('/tmp/', self.handle.cachedirs) + + self.handle.remove_cachedir('/tmp/') + self.assertNotIn('/tmp/', self.handle.cachedirs) + + def test_ignoregrps(self): + self.handle.add_ignoregrp('base') + self.assertIn('base', self.handle.ignoregrps) + + self.handle.remove_ignoregrp('base') + self.assertNotIn('base', self.handle.ignoregrps) + + def test_ignorepkg(self): + self.handle.add_ignorepkg('pacman') + self.assertIn('pacman', self.handle.ignorepkgs) + + self.handle.remove_ignorepkg('pacman') + self.assertNotIn('pacman', self.handle.ignorepkgs) + + def test_noextracts(self): + self.handle.add_noextract('index.php') + self.assertIn('index.php', self.handle.noextracts) + + self.handle.remove_noextract('index.php') + self.assertNotIn('index.php', self.handle.noextracts) + + def test_noupgrade(self): + self.handle.add_noupgrade('linux') + self.assertIn('linux', self.handle.noupgrades) + + self.handle.remove_noupgrade('linux') + self.assertNotIn('linux', self.handle.noupgrades) + +# vim: set ts=4 sw=4 et: -- 2.10.1
participants (1)
-
Jelle van der Waa