summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorlovetox <philipp@hoerist.com>2022-01-30 17:15:40 +0100
committerGitHub <noreply@github.com>2022-01-30 11:15:40 -0500
commitd259e1d5ae2d71c2c8d8a9ea6317dc1de785dbad (patch)
treea122d16716ccd5259268e268eef0a626128ae54e /tests
parent07f19b6350bfa2c293b11ba781394052ee333a54 (diff)
downloadpyopenssl-d259e1d5ae2d71c2c8d8a9ea6317dc1de785dbad.tar.gz
Don’t inherit from object (#1084)
In python3 all classes inherit by default from object
Diffstat (limited to 'tests')
-rw-r--r--tests/test_crypto.py34
-rw-r--r--tests/test_rand.py2
-rw-r--r--tests/test_ssl.py38
-rw-r--r--tests/test_util.py2
-rw-r--r--tests/util.py6
5 files changed, 41 insertions, 41 deletions
diff --git a/tests/test_crypto.py b/tests/test_crypto.py
index 7fcce12..d66e257 100644
--- a/tests/test_crypto.py
+++ b/tests/test_crypto.py
@@ -809,7 +809,7 @@ def x509_data():
yield pkey, x509
-class TestX509Ext(object):
+class TestX509Ext:
"""
Tests for `OpenSSL.crypto.X509Extension`.
"""
@@ -1008,7 +1008,7 @@ class TestX509Ext(object):
)
-class TestPKey(object):
+class TestPKey:
"""
Tests for `OpenSSL.crypto.PKey`.
"""
@@ -1222,7 +1222,7 @@ def x509_name(**attrs):
return name
-class TestX509Name(object):
+class TestX509Name:
"""
Unit tests for `OpenSSL.crypto.X509Name`.
"""
@@ -2224,7 +2224,7 @@ tgI5
assert crypto_cert.version.value == cert.get_version()
-class TestX509Store(object):
+class TestX509Store:
"""
Test for `OpenSSL.crypto.X509Store`.
"""
@@ -2295,7 +2295,7 @@ class TestX509Store(object):
def test_load_locations_parameters(
self, cafile, capath, call_cafile, call_capath, monkeypatch
):
- class LibMock(object):
+ class LibMock:
def load_locations(self, store, cafile, capath):
self.cafile = cafile
self.capath = capath
@@ -2326,7 +2326,7 @@ class TestX509Store(object):
store.load_locations(cafile=str(invalid_ca_file))
-class TestPKCS12(object):
+class TestPKCS12:
"""
Test for `OpenSSL.crypto.PKCS12` and `OpenSSL.crypto.load_pkcs12`.
"""
@@ -2802,7 +2802,7 @@ def _runopenssl(pem, *args):
return output
-class TestLoadPublicKey(object):
+class TestLoadPublicKey:
"""
Tests for :func:`load_publickey`.
"""
@@ -2842,7 +2842,7 @@ class TestLoadPublicKey(object):
assert dumped_pem == cleartextPublicKeyPEM
-class TestFunction(object):
+class TestFunction:
"""
Tests for free-functions in the `OpenSSL.crypto` module.
"""
@@ -3263,7 +3263,7 @@ class TestFunction(object):
load_pkcs7_data(object(), b"foo")
-class TestLoadCertificate(object):
+class TestLoadCertificate:
"""
Tests for `load_certificate_request`.
"""
@@ -3287,7 +3287,7 @@ class TestLoadCertificate(object):
load_certificate(FILETYPE_ASN1, b"lol")
-class TestPKCS7(object):
+class TestPKCS7:
"""
Tests for `PKCS7`.
"""
@@ -3387,7 +3387,7 @@ class TestNetscapeSPKI(_PKeyInteractionTestsMixin):
assert isinstance(blob, bytes)
-class TestRevoked(object):
+class TestRevoked:
"""
Tests for `OpenSSL.crypto.Revoked`.
"""
@@ -3497,7 +3497,7 @@ class TestRevoked(object):
revoked.set_reason(b"blue")
-class TestCRL(object):
+class TestCRL:
"""
Tests for `OpenSSL.crypto.CRL`.
"""
@@ -3858,7 +3858,7 @@ class TestCRL(object):
assert isinstance(crypto_crl, x509.CertificateRevocationList)
-class TestX509StoreContext(object):
+class TestX509StoreContext:
"""
Tests for `OpenSSL.crypto.X509StoreContext`.
"""
@@ -4226,7 +4226,7 @@ class TestX509StoreContext(object):
assert exc.value.args[0][2] == "unable to get local issuer certificate"
-class TestSignVerify(object):
+class TestSignVerify:
"""
Tests for `OpenSSL.crypto.sign` and `OpenSSL.crypto.verify`.
"""
@@ -4348,7 +4348,7 @@ class TestSignVerify(object):
sign(priv_key, content, "sha256")
-class TestEllipticCurve(object):
+class TestEllipticCurve:
"""
Tests for `_EllipticCurve`, `get_elliptic_curve`, and
`get_elliptic_curves`.
@@ -4399,7 +4399,7 @@ class TestEllipticCurve(object):
curve._to_EC_KEY()
-class EllipticCurveFactory(object):
+class EllipticCurveFactory:
"""
A helper to get the names of two curves.
"""
@@ -4434,7 +4434,7 @@ class TestEllipticCurveEquality(EqualityTestsMixin):
return get_elliptic_curve(self.curve_factory.another_curve_name)
-class TestEllipticCurveHash(object):
+class TestEllipticCurveHash:
"""
Tests for `_EllipticCurve`'s implementation of hashing (thus use as
an item in a `dict` or `set`).
diff --git a/tests/test_rand.py b/tests/test_rand.py
index 763d711..24f3093 100644
--- a/tests/test_rand.py
+++ b/tests/test_rand.py
@@ -10,7 +10,7 @@ import pytest
from OpenSSL import rand
-class TestRand(object):
+class TestRand:
@pytest.mark.parametrize("args", [(b"foo", None), (None, 3)])
def test_add_wrong_args(self, args):
"""
diff --git a/tests/test_ssl.py b/tests/test_ssl.py
index 1531118..bda2870 100644
--- a/tests/test_ssl.py
+++ b/tests/test_ssl.py
@@ -410,7 +410,7 @@ def handshake_in_memory(client_conn, server_conn):
interact_in_memory(client_conn, server_conn)
-class TestVersion(object):
+class TestVersion:
"""
Tests for version information exposed by `OpenSSL.SSL.SSLeay_version` and
`OpenSSL.SSL.OPENSSL_VERSION_NUMBER`.
@@ -491,7 +491,7 @@ def context():
return Context(SSLv23_METHOD)
-class TestContext(object):
+class TestContext:
"""
Unit tests for `OpenSSL.SSL.Context`.
"""
@@ -1364,7 +1364,7 @@ class TestContext(object):
)
serverConnection = Connection(serverContext, None)
- class VerifyCallback(object):
+ class VerifyCallback:
def callback(self, connection, *args):
self.connection = connection
return 1
@@ -1776,7 +1776,7 @@ class TestContext(object):
assert context.set_tlsext_use_srtp(b"SRTP_AES128_CM_SHA1_80") is None
-class TestServerNameCallback(object):
+class TestServerNameCallback:
"""
Tests for `Context.set_tlsext_servername_callback` and its
interaction with `Connection`.
@@ -1885,7 +1885,7 @@ class TestServerNameCallback(object):
assert args == [(server, b"foo1.example.com")]
-class TestApplicationLayerProtoNegotiation(object):
+class TestApplicationLayerProtoNegotiation:
"""
Tests for ALPN in PyOpenSSL.
"""
@@ -2165,7 +2165,7 @@ class TestApplicationLayerProtoNegotiation(object):
assert select_args == [(server, [b"http/1.1", b"spdy/2"])]
-class TestSession(object):
+class TestSession:
"""
Unit tests for :py:obj:`OpenSSL.SSL.Session`.
"""
@@ -2179,7 +2179,7 @@ class TestSession(object):
assert isinstance(new_session, Session)
-class TestConnection(object):
+class TestConnection:
"""
Unit tests for `OpenSSL.SSL.Connection`.
"""
@@ -2979,7 +2979,7 @@ class TestConnection(object):
assert 2 == len(data)
-class TestConnectionGetCipherList(object):
+class TestConnectionGetCipherList:
"""
Tests for `Connection.get_cipher_list`.
"""
@@ -3005,7 +3005,7 @@ class VeryLarge(bytes):
return 2**31
-class TestConnectionSend(object):
+class TestConnectionSend:
"""
Tests for `Connection.send`.
"""
@@ -3091,7 +3091,7 @@ def _make_memoryview(size):
return memoryview(bytearray(size))
-class TestConnectionRecvInto(object):
+class TestConnectionRecvInto:
"""
Tests for `Connection.recv_into`.
"""
@@ -3214,7 +3214,7 @@ class TestConnectionRecvInto(object):
self._doesnt_overfill_test(_make_memoryview)
-class TestConnectionSendall(object):
+class TestConnectionSendall:
"""
Tests for `Connection.sendall`.
"""
@@ -3296,7 +3296,7 @@ class TestConnectionSendall(object):
assert err.value.args[0] == EPIPE
-class TestConnectionRenegotiate(object):
+class TestConnectionRenegotiate:
"""
Tests for SSL renegotiation APIs.
"""
@@ -3340,7 +3340,7 @@ class TestConnectionRenegotiate(object):
pass
-class TestError(object):
+class TestError:
"""
Unit tests for `OpenSSL.SSL.Error`.
"""
@@ -3353,7 +3353,7 @@ class TestError(object):
assert Error.__name__ == "Error"
-class TestConstants(object):
+class TestConstants:
"""
Tests for the values of constants exposed in `OpenSSL.SSL`.
@@ -3470,7 +3470,7 @@ class TestConstants(object):
assert 0x300 == SESS_CACHE_NO_INTERNAL
-class TestMemoryBIO(object):
+class TestMemoryBIO:
"""
Tests for `OpenSSL.SSL.Connection` using a memory BIO.
"""
@@ -3894,7 +3894,7 @@ class TestMemoryBIO(object):
self._check_client_ca_list(set_replaces_add_ca)
-class TestInfoConstants(object):
+class TestInfoConstants:
"""
Tests for assorted constants exposed for use in info callbacks.
"""
@@ -3937,7 +3937,7 @@ class TestInfoConstants(object):
assert const is None or isinstance(const, int)
-class TestRequires(object):
+class TestRequires:
"""
Tests for the decorator factory used to conditionally raise
NotImplementedError when older OpenSSLs are used.
@@ -3976,7 +3976,7 @@ class TestRequires(object):
assert "Error text" in str(e.value)
-class TestOCSP(object):
+class TestOCSP:
"""
Tests for PyOpenSSL's OCSP stapling support.
"""
@@ -4222,7 +4222,7 @@ class TestOCSP(object):
handshake_in_memory(client, server)
-class TestDTLS(object):
+class TestDTLS:
# The way you would expect DTLSv1_listen to work is:
#
# - it reads packets in a loop
diff --git a/tests/test_util.py b/tests/test_util.py
index 6224448..e029d71 100644
--- a/tests/test_util.py
+++ b/tests/test_util.py
@@ -3,7 +3,7 @@ import pytest
from OpenSSL._util import exception_from_error_queue, lib
-class TestErrors(object):
+class TestErrors:
"""
Tests for handling of certain OpenSSL error cases.
"""
diff --git a/tests/util.py b/tests/util.py
index 566146c..b4649e3 100644
--- a/tests/util.py
+++ b/tests/util.py
@@ -30,7 +30,7 @@ def is_consistent_type(theType, name, *constructionArgs):
return True
-class EqualityTestsMixin(object):
+class EqualityTestsMixin:
"""
A mixin defining tests for the standard implementation of C{==} and C{!=}.
"""
@@ -126,7 +126,7 @@ class EqualityTestsMixin(object):
operand if it is of an unrelated type.
"""
- class Delegate(object):
+ class Delegate:
def __eq__(self, other):
# Do something crazy and obvious.
return [self]
@@ -141,7 +141,7 @@ class EqualityTestsMixin(object):
operand if it is of an unrelated type.
"""
- class Delegate(object):
+ class Delegate:
def __ne__(self, other):
# Do something crazy and obvious.
return [self]