/usr/lib/python3/dist-packages/josepy
NameSizeModeActions
__pycache__/-0755rm
b64.py15040644editdlrm
b64_test.py23260644editdlrm
errors.py8150644editdlrm
errors_test.py4630644editdlrm
interfaces.py78490644editdlrm
interfaces_test.py36240644editdlrm
json_util.py157480644editdlrm
json_util_test.py142770644editdlrm
jwa.py62610644editdlrm
jwa_test.py46530644editdlrm
jwk.py94150644editdlrm
jwk_test.py70870644editdlrm
jws.py142600644editdlrm
jws_test.py85200644editdlrm
magic_typing.py3710644editdlrm
magic_typing_test.py14860644editdlrm
test_util.py22820644editdlrm
util.py75530644editdlrm
util_test.py66030644editdlrm
__init__.py16710644editdlrm
Edit: /usr/lib/python3/dist-packages/josepy/util_test.py (6603B)
"""Tests for josepy.util.""" import functools import unittest import six from josepy import test_util class ComparableX509Test(unittest.TestCase): """Tests for josepy.util.ComparableX509.""" def setUp(self): # test_util.load_comparable_{csr,cert} return ComparableX509 self.req1 = test_util.load_comparable_csr('csr.pem') self.req2 = test_util.load_comparable_csr('csr.pem') self.req_other = test_util.load_comparable_csr('csr-san.pem') self.cert1 = test_util.load_comparable_cert('cert.pem') self.cert2 = test_util.load_comparable_cert('cert.pem') self.cert_other = test_util.load_comparable_cert('cert-san.pem') def test_getattr_proxy(self): self.assertTrue(self.cert1.has_expired()) def test_eq(self): self.assertEqual(self.req1, self.req2) self.assertEqual(self.cert1, self.cert2) def test_ne(self): self.assertNotEqual(self.req1, self.req_other) self.assertNotEqual(self.cert1, self.cert_other) def test_ne_wrong_types(self): self.assertNotEqual(self.req1, 5) self.assertNotEqual(self.cert1, 5) def test_hash(self): self.assertEqual(hash(self.req1), hash(self.req2)) self.assertNotEqual(hash(self.req1), hash(self.req_other)) self.assertEqual(hash(self.cert1), hash(self.cert2)) self.assertNotEqual(hash(self.cert1), hash(self.cert_other)) def test_repr(self): for x509 in self.req1, self.cert1: self.assertEqual(repr(x509), ''.format(x509.wrapped)) class ComparableRSAKeyTest(unittest.TestCase): """Tests for josepy.util.ComparableRSAKey.""" def setUp(self): # test_utl.load_rsa_private_key return ComparableRSAKey self.key = test_util.load_rsa_private_key('rsa256_key.pem') self.key_same = test_util.load_rsa_private_key('rsa256_key.pem') self.key2 = test_util.load_rsa_private_key('rsa512_key.pem') def test_getattr_proxy(self): self.assertEqual(256, self.key.key_size) def test_eq(self): self.assertEqual(self.key, self.key_same) def test_ne(self): self.assertNotEqual(self.key, self.key2) def test_ne_different_types(self): self.assertNotEqual(self.key, 5) def test_ne_not_wrapped(self): # pylint: disable=protected-access self.assertNotEqual(self.key, self.key_same._wrapped) def test_ne_no_serialization(self): from josepy.util import ComparableRSAKey self.assertNotEqual(ComparableRSAKey(5), ComparableRSAKey(5)) def test_hash(self): self.assertTrue(isinstance(hash(self.key), int)) self.assertEqual(hash(self.key), hash(self.key_same)) self.assertNotEqual(hash(self.key), hash(self.key2)) def test_repr(self): self.assertTrue(repr(self.key).startswith( '