[python-debian/master 2/2] test_deb822.py: Update to support new gpg "SIG_ID" algorithm

John Wright john.wright at hp.com
Thu Jan 28 23:16:43 UTC 2010


In the changelog for gpg version 1.4.10:

    * The algorithm to compute the SIG_ID status has been changed to
      match the one from 2.0.10.

This results in the value of the SIG_ID field returned by the
get_gpg_info() method having a different value than the one we
originally expected.  I modified the test to accept results from either
the old or the new version.
---
 debian/changelog     |    1 +
 tests/test_deb822.py |   28 ++++++++++++++++++++--------
 2 files changed, 21 insertions(+), 8 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 8969bbe..da65662 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -21,6 +21,7 @@ python-debian (0.1.15) UNRELEASED; urgency=low
   [ John Wright ]
   * deb822: Use the apt_pkg.TagFile class instead of apt_pkg.ParseTagFile()
     (Closes: #552190)
+  * test_deb822.py: Update to support new gpg "SIG_ID" algorithm
 
  -- Filippo Giunchedi <filippo at debian.org>  Sun, 09 Aug 2009 13:01:16 +0100
 
diff --git a/tests/test_deb822.py b/tests/test_deb822.py
index 2ac1812..0bde032 100755
--- a/tests/test_deb822.py
+++ b/tests/test_deb822.py
@@ -351,16 +351,28 @@ class TestDeb822(unittest.TestCase):
         result_from_file = deb822_from_file.get_gpg_info()
         deb822_from_lines = deb822.Dsc(unparsed_with_gpg.splitlines())
         result_from_lines = deb822_from_lines.get_gpg_info()
-        valid = {'GOODSIG':  ['D14219877A786561', 'John Wright <john.wright at hp.com>'],
-                 'VALIDSIG': ['8FEFE900783CF175827C2F65D14219877A786561', '2008-05-01',
-                              '1209623566', '0', '3', '0', '17', '2', '01',
-                              '8FEFE900783CF175827C2F65D14219877A786561'],
-                 'SIG_ID':   ['mQFnUWWR1Gr6itMV7Bx5L4N60Wo', '2008-05-01', '1209623566']}
 
+        # The signature id algorithm changed in gnupg 1.4.10
+        valid_old = {
+         'GOODSIG':  ['D14219877A786561', 'John Wright <john.wright at hp.com>'],
+         'VALIDSIG': ['8FEFE900783CF175827C2F65D14219877A786561', '2008-05-01',
+                      '1209623566', '0', '3', '0', '17', '2', '01',
+                      '8FEFE900783CF175827C2F65D14219877A786561'],
+         'SIG_ID':   ['mQFnUWWR1Gr6itMV7Bx5L4N60Wo', '2008-05-01',
+                      '1209623566'],
+        }
+        valid_new = {
+         'GOODSIG':  ['D14219877A786561', 'John Wright <john.wright at hp.com>'],
+         'VALIDSIG': ['8FEFE900783CF175827C2F65D14219877A786561', '2008-05-01',
+                      '1209623566', '0', '3', '0', '17', '2', '01',
+                      '8FEFE900783CF175827C2F65D14219877A786561'],
+         'SIG_ID':   ['j3UjSpdky92fcQISbm8W5PlwC/g', '2008-05-01',
+                      '1209623566'],
+        }
+
+        valid = (sorted(valid_old.items()), sorted(valid_new.items()))
         for result in result_from_str, result_from_file, result_from_lines:
-            self.assertEqual(len(result.keys()), len(valid.keys()))
-            for k,v in valid.items():
-                self.assertEqual(''.join(v), ''.join(result[k]))
+            self.assert_(sorted(result.items()) in valid)
 
     def test_iter_paragraphs_array(self):
         text = (UNPARSED_PACKAGE + '\n\n\n' + UNPARSED_PACKAGE).splitlines()
-- 
1.6.3.3




More information about the pkg-python-debian-commits mailing list