summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDidier Raboud <odyx@debian.org>2012-05-23 10:43:38 +0200
committerDidier Raboud <odyx@debian.org>2012-05-23 14:56:48 +0200
commitaa85cb7a8af20c64c056a966a8bba9924ae56bc8 (patch)
tree76f2eb03ba586efa796732d0b5fbba86b1b37040 /test
parentba6cd5f9c8d35f9683aa40092c29e65b81933032 (diff)
PyUT: Implement test for lsb_release.get_distro_information.
Diffstat (limited to 'test')
-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 50c8995..87e5af0 100644
--- a/test/test_lsb_release.py
+++ b/test/test_lsb_release.py
@@ -261,9 +261,21 @@ class TestLSBRelease(unittest.TestCase):
self.assertEqual(lr.get_lsb_information(),supposed_output)
os.environ.pop('LSB_ETC_LSB_RELEASE')
- @unittest.skip('Test not implemented.')
def test_get_distro_information(self):
- raise NotImplementedError()
+ # Test that an inexistant /etc/lsb-release leads to empty output
+ supposed_output = get_arch_distinfo()
+ supposed_output['RELEASE'] = 'testing/unstable';
+ supposed_output['DESCRIPTION'] = '%(ID)s %(OS)s %(RELEASE)s' % supposed_output
+
+ os.environ['LSB_ETC_LSB_RELEASE'] = 'test/inexistant_file_' + rnd_string(2,5)
+ fn = 'test/debian_version_' + rnd_string(5,12)
+ f = open(fn,'w')
+ f.write('testing/sid')
+ f.close()
+ os.environ['LSB_ETC_DEBIAN_VERSION'] = fn
+ self.assertEqual(lr.get_distro_information(),supposed_output)
+ os.remove(fn)
+ os.environ.pop('LSB_ETC_DEBIAN_VERSION')
if __name__ == '__main__':
unittest.main()