[Cryptech-Commits] [sw/libhal] branch master updated: TestPKeyMatch was a little sloppy when counting keys.

git at cryptech.is git at cryptech.is
Thu May 11 20:57:33 UTC 2017


This is an automated email from the git hooks/post-receive script.

sra at hactrn.net pushed a commit to branch master
in repository sw/libhal.

The following commit(s) were added to refs/heads/master by this push:
     new 478b0c5  TestPKeyMatch was a little sloppy when counting keys.
478b0c5 is described below

commit 478b0c56bb2ea284eb502b03f1b0291bd966fd93
Author: Rob Austein <sra at hactrn.net>
AuthorDate: Thu May 11 16:57:15 2017 -0400

    TestPKeyMatch was a little sloppy when counting keys.
---
 unit-tests.py | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/unit-tests.py b/unit-tests.py
index a3e4282..338af64 100644
--- a/unit-tests.py
+++ b/unit-tests.py
@@ -599,17 +599,20 @@ class TestPKeyMatch(TestCaseLoggedIn):
             tags.extend(PreloadedKey.db)
         self.assertEqual(len(tags), len(uuids))
 
+        n = 0
         self.assertEqual(uuids, set(k.uuid for n, k in self.match(mask  = mask,
                                                                   flags = flags,
                                                                   uuids = uuids)))
 
         for keytype in set(HALKeyType.index.itervalues()) - {HAL_KEY_TYPE_NONE}:
+            n = 0
             for n, k in self.match(mask = mask, flags = flags, uuids = uuids, type = keytype):
                 self.assertEqual(k.key_type, keytype)
                 self.assertEqual(k.get_attributes({0}).pop(0), str(keytype))
             self.assertEqual(n, sum(1 for t1, t2 in tags if t1 == keytype))
 
         for curve in set(HALCurve.index.itervalues()) - {HAL_CURVE_NONE}:
+            n = 0
             for n, k in self.match(mask = mask, flags = flags, uuids = uuids, curve = curve):
                 self.assertEqual(k.key_curve, curve)
                 self.assertEqual(k.get_attributes({1}).pop(1), str(curve))
@@ -618,6 +621,7 @@ class TestPKeyMatch(TestCaseLoggedIn):
             self.assertEqual(n, sum(1 for t1, t2 in tags if t2 == curve))
 
         for keylen in set(kl for kt, kl in tags if not isinstance(kl, Enum)):
+            n = 0
             for n, k in self.match(mask = mask, flags = flags, uuids = uuids,
                                    attributes = {1 : str(keylen)}):
                 self.assertEqual(keylen, int(k.get_attributes({1}).pop(1)))
@@ -626,6 +630,7 @@ class TestPKeyMatch(TestCaseLoggedIn):
             self.assertEqual(n, sum(1 for t1, t2 in tags
                                     if not isinstance(t2, Enum) and  t2 == keylen))
 
+        n = 0
         for n, k in self.match(mask = mask, flags = flags, uuids = uuids,
                                type = HAL_KEY_TYPE_RSA_PUBLIC, attributes = {1 : "2048"}):
             self.assertEqual(k.key_type, HAL_KEY_TYPE_RSA_PUBLIC)

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Commits mailing list