Add test case for #675618.
authorDidier Raboud <odyx@debian.org>
Mon, 4 Jun 2012 17:55:29 +0000 (19:55 +0200)
committerDidier Raboud <odyx@debian.org>
Mon, 4 Jun 2012 18:13:30 +0000 (20:13 +0200)
test/apt-cache
test/test_lsb_release.py

index a31c998e23642567ad9702c9056d96184d3da2a9..c9a3ae7440f3c9b97a8eae1209ed0f7ae3f14f91 100755 (executable)
@@ -1,4 +1,5 @@
 #!/usr/bin/python
+# coding=utf-8
 
 # Fake apt-cache python script to emulate policy output for test usage
 
@@ -25,6 +26,11 @@ if os.environ.get('TEST_APT_CACHE2') == '600':
        print('     release o=0RigIn,a=5uiTe,n=codename-not-read,l=1ABel,c=C03p0nent')
        print('     origin MirRor-is-not-read')
 
+if os.environ.get('TEST_APT_CACHE3') == '754':
+       print(' 754 http://MirRor_is_not_read/folder-either-debian/ sid/main arch Packages')
+       print('     release o=Jérôme Helvète,a=5uiTe,n=codename-not-read,l=1ABel,c=C03p0nent')
+       print('     origin MirRor-is-not-read')
+
 if os.environ.get('TEST_APT_CACHE_RELEASE') == '512':
        print(' 512 http://MirRor_is_not_read/folder-either-debian/ sid/main arch Packages')
        print('     release o=or1g1n,a=testing,n=codename-not-read,l=l8bel,c=c0mp0nent')
index 100c0d2f51fa0fe736ca45efa08e7531337b7f75..63e632c2c38dab1361e0b55f04f53d4af7f4aa93 100644 (file)
@@ -1,4 +1,7 @@
 #!/usr/bin/python
+# coding=utf-8
+from __future__ import unicode_literals
+
 import unittest
 
 import lsb_release as lr
@@ -175,12 +178,18 @@ class TestLSBRelease(unittest.TestCase):
                os.environ['TEST_APT_CACHE2'] = '600'
                supposed_output.append((600, {'origin': '0RigIn', 'suite': '5uiTe', 'component': 'C03p0nent', 'label': '1ABel'}))
                self.assertEqual(lr.parse_apt_policy(),supposed_output)
+               # Add a third fake entry, unordered, with non-ascii chars (#675618)
+               os.environ['TEST_APT_CACHE3'] = '754'
+               supposed_output.append((754, {'origin': 'Jérôme Helvète', 'suite': '5uiTe', 'component': 'C03p0nent', 'label': '1ABel'}))
+               self.assertEqual(lr.parse_apt_policy(),supposed_output)
                os.environ.pop('TEST_APT_CACHE1')
                os.environ.pop('TEST_APT_CACHE2')
+               os.environ.pop('TEST_APT_CACHE3')
 
        def test_guess_release_from_apt(self):
                os.environ['TEST_APT_CACHE1'] = '932'
                os.environ['TEST_APT_CACHE2'] = '600'
+               os.environ['TEST_APT_CACHE3'] = '754'
                os.environ['TEST_APT_CACHE_RELEASE'] = '512'
                supposed_output = {'origin': 'or1g1n', 'suite': 'testing', 'component': 'c0mp0nent', 'label': 'l8bel'}
                self.assertEqual(
@@ -203,6 +212,7 @@ class TestLSBRelease(unittest.TestCase):
                        supposed_output)
                os.environ.pop('TEST_APT_CACHE1')
                os.environ.pop('TEST_APT_CACHE2')
+               os.environ.pop('TEST_APT_CACHE3')
                os.environ.pop('TEST_APT_CACHE_RELEASE')
 
        def test_guess_debian_release(self):