aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Austein <sra@hactrn.net>2017-05-11 16:57:15 -0400
committerRob Austein <sra@hactrn.net>2017-05-11 16:57:15 -0400
commit478b0c56bb2ea284eb502b03f1b0291bd966fd93 (patch)
treea62252525502418ac5924997195c8edc745a2eba
parent052a0781ec41780b534aca749540ed5b939a721a (diff)
TestPKeyMatch was a little sloppy when counting keys.
-rw-r--r--unit-tests.py5
1 files changed, 5 insertions, 0 deletions
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)