Skip to content

Instantly share code, notes, and snippets.

@Daviey

Daviey/- Secret

Created July 27, 2015 23:39
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save Daviey/4292516e53964d613c4a to your computer and use it in GitHub Desktop.
diff --git a/tests/test_certificate_ops.py b/tests/test_certificate_ops.py
index 852a9e5..bb29550 100644
--- a/tests/test_certificate_ops.py
+++ b/tests/test_certificate_ops.py
@@ -128,9 +128,9 @@ class CertificateOpsTests(unittest.TestCase):
data = {'validators': validators}
with mock.patch.dict(config, data):
- with self.assertRaises(http_status.HTTPException) as cm:
+ with self.assertRaises(http_status.HTTPException):
certificate_ops.validate_csr(None, csr_obj, None)
- self.assertEqual(cm.exception.code, 400)
+ self.assertRaises(http_status.HTTPBadRequest)
def test_ca_cert_read_failure(self):
"""Test CA certificate read failure."""
@@ -140,9 +140,9 @@ class CertificateOpsTests(unittest.TestCase):
'key_path': 'tests/CA/root-ca-unwrapped.key'}}
with mock.patch.dict(config, data):
- with self.assertRaises(http_status.HTTPException) as cm:
+ with self.assertRaises(http_status.HTTPException):
certificate_ops.sign(csr_obj)
- self.assertEqual(cm.exception.code, 500)
+ self.assertRaises(http_status.HTTPInternalServerError)
def test_ca_key_read_failure(self):
"""Test CA key read failure."""
@@ -152,6 +152,6 @@ class CertificateOpsTests(unittest.TestCase):
'key_path': '/xxx/not/a/valid/path'}}
with mock.patch.dict(config, data):
- with self.assertRaises(http_status.HTTPException) as cm:
+ with self.assertRaises(http_status.HTTPException):
certificate_ops.sign(csr_obj)
- self.assertEqual(cm.exception.code, 500)
+ self.assertRaises(http_status.HTTPInternalServerError)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment