summaryrefslogtreecommitdiff
path: root/test/test_lsb_release.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/test_lsb_release.py')
-rw-r--r--test/test_lsb_release.py16
1 files changed, 14 insertions, 2 deletions
diff --git a/test/test_lsb_release.py b/test/test_lsb_release.py
index 0292f4a..6c9c3a2 100644
--- a/test/test_lsb_release.py
+++ b/test/test_lsb_release.py
@@ -6,6 +6,8 @@ import lsb_release as lr
import random
import string
+import os
+
def rnd_string(min_l,max_l):
return ''.join( [random.choice(string.letters) for i in xrange(random.randint(min_l,max_l))])
@@ -102,9 +104,19 @@ class TestLSBRelease(unittest.TestCase):
supposed_output,
'compare_release(' + x[1]['suite'] + ',' + y[1]['suite'] + ') =? ' + str(supposed_output))
- @unittest.skip('Test not implemented.')
def test_parse_apt_policy(self):
- raise NotImplementedError()
+ # Test almost-empty apt-cache policy
+ supposed_output = [(100, {'suite': 'now'})]
+ self.assertEqual(lr.parse_apt_policy(),supposed_output)
+ # Add one fake entry
+ os.environ['TEST_APT_CACHE1'] = '132'
+ supposed_output.append((132, {'origin': 'oRigIn', 'suite': 'SuiTe', 'component': 'C0mp0nent', 'label': 'lABel'}))
+ self.assertEqual(lr.parse_apt_policy(),supposed_output)
+ # Add a second fake entry, unordered
+ os.environ['TEST_APT_CACHE2'] = '35'
+ supposed_output.append((35, {'origin': '0RigIn', 'suite': '5uiTe', 'component': 'C03p0nent', 'label': '1ABel'}))
+ self.assertEqual(lr.parse_apt_policy(),supposed_output)
+
@unittest.skip('Test not implemented.')
def test_guess_release_from_apt(self):
raise NotImplementedError()