From 70c8f8b4d96f6a26f016e43d61005ad12027cc1e Mon Sep 17 00:00:00 2001 From: Alex Gaynor Date: Mon, 6 Jul 2015 21:02:54 -0400 Subject: Fixed #2121 -- added __eq__ and __ne__ to CSRs --- tests/test_x509.py | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'tests') diff --git a/tests/test_x509.py b/tests/test_x509.py index 90b3fe5f..19fe1043 100644 --- a/tests/test_x509.py +++ b/tests/test_x509.py @@ -694,6 +694,35 @@ class TestRSACertificateRequest(object): serialized = request.public_bytes(encoding) assert serialized == request_bytes + def test_eq(self, backend): + request1 = _load_cert( + os.path.join("x509", "requests", "rsa_sha1.pem"), + x509.load_pem_x509_csr, + backend + ) + request2 = _load_cert( + os.path.join("x509", "requests", "rsa_sha1.pem"), + x509.load_pem_x509_csr, + backend + ) + + assert request1 == request2 + + def test_ne(self, backend): + request1 = _load_cert( + os.path.join("x509", "requests", "rsa_sha1.pem"), + x509.load_pem_x509_csr, + backend + ) + request2 = _load_cert( + os.path.join("x509", "requests", "rsa_sha1.pem"), + x509.load_pem_x509_csr, + backend + ) + + assert request1 != request2 + assert request1 != object() + @pytest.mark.requires_backend_interface(interface=X509Backend) class TestCertificateSigningRequestBuilder(object): -- cgit v1.2.3 From eb2df546027650469768c9ad1571df96e423206a Mon Sep 17 00:00:00 2001 From: Alex Gaynor Date: Mon, 6 Jul 2015 21:50:15 -0400 Subject: fixed test --- tests/test_x509.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/test_x509.py b/tests/test_x509.py index 19fe1043..80ae0a22 100644 --- a/tests/test_x509.py +++ b/tests/test_x509.py @@ -715,7 +715,7 @@ class TestRSACertificateRequest(object): backend ) request2 = _load_cert( - os.path.join("x509", "requests", "rsa_sha1.pem"), + os.path.join("x509", "requests", "san_rsa_sha1.pem"), x509.load_pem_x509_csr, backend ) -- cgit v1.2.3