summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Paul Calderone <exarkun@twistedmatrix.com>2014-05-01 07:49:47 -0400
committerJean-Paul Calderone <exarkun@twistedmatrix.com>2014-05-01 07:49:47 -0400
commit22c3124d9535f0cdcb9199ad25cc25f99141dd8d (patch)
tree16f432b4f4d3905b46b2a076ca7c716d2d1ad4f6
parent73945e3fbc15ad19fd098af00cbf31d4c4bbaf7a (diff)
downloadpyopenssl-22c3124d9535f0cdcb9199ad25cc25f99141dd8d.tar.gz
Directly test that curves work well as set elements.
-rw-r--r--OpenSSL/test/test_crypto.py32
1 files changed, 32 insertions, 0 deletions
diff --git a/OpenSSL/test/test_crypto.py b/OpenSSL/test/test_crypto.py
index 8dc19cf..34e60a3 100644
--- a/OpenSSL/test/test_crypto.py
+++ b/OpenSSL/test/test_crypto.py
@@ -3176,5 +3176,37 @@ class EllipticCurveEqualityTests(TestCase, EqualityTestsMixin):
+class EllipticCurveHashTests(TestCase):
+ """
+ Tests for :py:type:`_EllipticCurve`\ 's implementation of hashing (thus use
+ as an item in a :py:type:`dict` or :py:type:`set`).
+ """
+ curve_factory = EllipticCurveFactory()
+
+ if curve_factory.curve_name is None:
+ skip = "There are no curves available there can be no curve objects."
+
+
+ def test_contains(self):
+ """
+ The ``in`` operator reports that a :py:type:`set` containing a curve
+ does contain that curve.
+ """
+ curve = get_elliptic_curve(self.curve_factory.curve_name)
+ curves = set([curve])
+ self.assertIn(curve, curves)
+
+
+ def test_does_not_contain(self):
+ """
+ The ``in`` operator reports that a :py:type:`set` not containing a
+ curve does not contain that curve.
+ """
+ curve = get_elliptic_curve(self.curve_factory.curve_name)
+ curves = set([get_elliptic_curve(self.curve_factory.another_curve_name)])
+ self.assertNotIn(curve, curves)
+
+
+
if __name__ == '__main__':
main()