summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDidier Raboud <odyx@debian.org>2012-06-04 19:55:29 +0200
committerDidier Raboud <odyx@debian.org>2012-06-04 20:13:30 +0200
commit3ed284114a12da80aa7cba094899392cb44bdec1 (patch)
treef9e24c7f2627412d59ea3225190466db7ac2ff11 /test
parent9b2a6f476108e7856e0fddcb3bde2b5c28d67364 (diff)
Add test case for #675618.
Diffstat (limited to 'test')
-rwxr-xr-xtest/apt-cache6
-rw-r--r--test/test_lsb_release.py10
2 files changed, 16 insertions, 0 deletions
diff --git a/test/apt-cache b/test/apt-cache
index a31c998..c9a3ae7 100755
--- a/test/apt-cache
+++ b/test/apt-cache
@@ -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')
diff --git a/test/test_lsb_release.py b/test/test_lsb_release.py
index 100c0d2..63e632c 100644
--- a/test/test_lsb_release.py
+++ b/test/test_lsb_release.py
@@ -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):