Replace assertEqual(None, *) with assertIsNone in tests

Replace assertEqual(None, *) with assertIsNone in tests to have
more clear messages in case of failure.

Change-Id: I33b61064ec957a79bec4c6deef7ce5e4c8e8d141
Closes-bug: #1280522
This commit is contained in:
Shuquan Huang 2015-12-16 18:17:51 +08:00
parent 211cae97ab
commit 8f46701afb
1 changed files with 7 additions and 7 deletions

View File

@ -418,7 +418,7 @@ class TestValidators(tests.DefaultRequestMixin, unittest.TestCase):
ext.set_ca(False)
csr.add_extension(ext)
self.assertEqual(None, internal.ca_status(csr=csr))
self.assertIsNone(internal.ca_status(csr=csr))
def test_ca_status_forbidden(self):
csr = x509_csr.X509Csr()
@ -437,7 +437,7 @@ class TestValidators(tests.DefaultRequestMixin, unittest.TestCase):
ext.set_path_len_constraint(1)
csr.add_extension(ext)
self.assertEqual(None, internal.ca_status(csr=csr))
self.assertIsNone(internal.ca_status(csr=csr))
def test_ca_status_key_usage_bad1(self):
csr = x509_csr.X509Csr()
@ -555,7 +555,7 @@ class TestValidators(tests.DefaultRequestMixin, unittest.TestCase):
def test_csr_signature(self):
csr = x509_csr.X509Csr.from_buffer(self.csr_sample)
self.assertEqual(None, custom.csr_signature(csr=csr))
self.assertIsNone(custom.csr_signature(csr=csr))
def test_csr_signature_bad_sig(self):
csr = x509_csr.X509Csr.from_buffer(self.csr_sample)
@ -575,8 +575,8 @@ class TestValidators(tests.DefaultRequestMixin, unittest.TestCase):
def test_public_key_good_rsa(self):
csr = x509_csr.X509Csr.from_buffer(self.csr_sample)
self.assertEqual(None, custom.public_key(csr=csr,
allowed_keys={'RSA': 1024}))
self.assertIsNone(custom.public_key(csr=csr,
allowed_keys={'RSA': 1024}))
def test_public_key_good_dsa(self):
dsa_key_pem = """
@ -596,8 +596,8 @@ class TestValidators(tests.DefaultRequestMixin, unittest.TestCase):
asn1Spec=rfc2459.SubjectPublicKeyInfo())[0]
csr = x509_csr.X509Csr.from_buffer(self.csr_sample)
csr._csr['certificationRequestInfo']['subjectPublicKeyInfo'] = spki
self.assertEqual(None, custom.public_key(csr=csr,
allowed_keys={'DSA': 1024}))
self.assertIsNone(custom.public_key(csr=csr,
allowed_keys={'DSA': 1024}))
def test_public_key_too_short(self):
csr = x509_csr.X509Csr.from_buffer(self.csr_sample)