Fix order of arguments in assertEqual

The correct order expected by testtools is assertEqual(expected, observed).

Change-Id: I93eaab96f170e72cfcbc763f384fd9358842ef69
Partial-Bug: #1259292
changes/99/378699/2
Jiong Liu 6 years ago
parent 2c6a9a9bb0
commit 403e440f85
  1. 122
      barbican/tests/plugin/crypto/test_p11_crypto.py
  2. 100
      barbican/tests/plugin/crypto/test_pkcs11.py
  3. 4
      functionaltests/api/base.py
  4. 6
      functionaltests/api/v1/functional/test_cas.py
  5. 10
      functionaltests/api/v1/functional/test_certificate_orders.py
  6. 12
      functionaltests/api/v1/functional/test_consumers.py
  7. 40
      functionaltests/api/v1/functional/test_containers.py
  8. 68
      functionaltests/api/v1/functional/test_orders.py
  9. 2
      functionaltests/api/v1/functional/test_quotas_enforce.py
  10. 44
      functionaltests/api/v1/functional/test_secretmeta.py
  11. 120
      functionaltests/api/v1/functional/test_secrets.py
  12. 28
      functionaltests/api/v1/smoke/test_consumers.py
  13. 46
      functionaltests/api/v1/smoke/test_containers.py
  14. 38
      functionaltests/api/v1/smoke/test_orders.py
  15. 44
      functionaltests/api/v1/smoke/test_secrets.py
  16. 6
      functionaltests/api/v1/smoke/test_versions.py

@ -82,14 +82,14 @@ class WhenTestingP11CryptoPlugin(utils.BaseTestCase):
dto = plugin_import.KEKMetaDTO(kek_datum)
dto = self.plugin.bind_kek_metadata(dto)
self.assertEqual(dto.algorithm, 'AES')
self.assertEqual(dto.bit_length, 256)
self.assertEqual(dto.mode, 'CBC')
self.assertEqual('AES', dto.algorithm)
self.assertEqual(256, dto.bit_length)
self.assertEqual('CBC', dto.mode)
self.assertEqual(self.pkcs11.get_key_handle.call_count, 2)
self.assertEqual(self.pkcs11.generate_key.call_count, 1)
self.assertEqual(self.pkcs11.wrap_key.call_count, 1)
self.assertEqual(self.pkcs11.compute_hmac.call_count, 1)
self.assertEqual(2, self.pkcs11.get_key_handle.call_count)
self.assertEqual(1, self.pkcs11.generate_key.call_count)
self.assertEqual(1, self.pkcs11.wrap_key.call_count)
self.assertEqual(1, self.pkcs11.compute_hmac.call_count)
def test_bind_kek_metadata_with_existing_key(self):
kek_datum = models.KEKDatum()
@ -97,9 +97,9 @@ class WhenTestingP11CryptoPlugin(utils.BaseTestCase):
dto.plugin_meta = '{}'
dto = self.plugin.bind_kek_metadata(dto)
self.assertEqual(self.pkcs11.generate_key.call_count, 0)
self.assertEqual(self.pkcs11.wrap_key.call_count, 0)
self.assertEqual(self.pkcs11.compute_hmac.call_count, 0)
self.assertEqual(0, self.pkcs11.generate_key.call_count)
self.assertEqual(0, self.pkcs11.wrap_key.call_count)
self.assertEqual(0, self.pkcs11.compute_hmac.call_count)
def test_encrypt(self):
payload = b'test payload'
@ -115,15 +115,15 @@ class WhenTestingP11CryptoPlugin(utils.BaseTestCase):
kek_meta,
mock.MagicMock())
self.assertEqual(response_dto.cypher_text, b'0')
self.assertEqual(b'0', response_dto.cypher_text)
self.assertIn('iv', response_dto.kek_meta_extended)
self.assertEqual(self.pkcs11.get_key_handle.call_count, 2)
self.assertEqual(self.pkcs11.get_session.call_count, 2)
self.assertEqual(self.pkcs11.verify_hmac.call_count, 1)
self.assertEqual(self.pkcs11.unwrap_key.call_count, 1)
self.assertEqual(self.pkcs11.encrypt.call_count, 1)
self.assertEqual(self.pkcs11.return_session.call_count, 1)
self.assertEqual(2, self.pkcs11.get_key_handle.call_count)
self.assertEqual(2, self.pkcs11.get_session.call_count)
self.assertEqual(1, self.pkcs11.verify_hmac.call_count)
self.assertEqual(1, self.pkcs11.unwrap_key.call_count)
self.assertEqual(1, self.pkcs11.encrypt.call_count)
self.assertEqual(1, self.pkcs11.return_session.call_count)
def test_encrypt_bad_session(self):
self.pkcs11.get_session.return_value = mock.DEFAULT
@ -145,12 +145,12 @@ class WhenTestingP11CryptoPlugin(utils.BaseTestCase):
kek_meta,
mock.MagicMock())
self.assertEqual(self.pkcs11.get_key_handle.call_count, 2)
self.assertEqual(self.pkcs11.get_session.call_count, 2)
self.assertEqual(self.pkcs11.verify_hmac.call_count, 1)
self.assertEqual(self.pkcs11.unwrap_key.call_count, 1)
self.assertEqual(self.pkcs11.encrypt.call_count, 0)
self.assertEqual(self.pkcs11.return_session.call_count, 0)
self.assertEqual(2, self.pkcs11.get_key_handle.call_count)
self.assertEqual(2, self.pkcs11.get_session.call_count)
self.assertEqual(1, self.pkcs11.verify_hmac.call_count)
self.assertEqual(1, self.pkcs11.unwrap_key.call_count)
self.assertEqual(0, self.pkcs11.encrypt.call_count)
self.assertEqual(0, self.pkcs11.return_session.call_count)
def test_decrypt(self):
ct = b'ctct'
@ -168,14 +168,14 @@ class WhenTestingP11CryptoPlugin(utils.BaseTestCase):
kek_meta_extended,
mock.MagicMock())
self.assertEqual(pt, b'0')
self.assertEqual(b'0', pt)
self.assertEqual(self.pkcs11.get_key_handle.call_count, 2)
self.assertEqual(self.pkcs11.get_session.call_count, 2)
self.assertEqual(self.pkcs11.verify_hmac.call_count, 1)
self.assertEqual(self.pkcs11.unwrap_key.call_count, 1)
self.assertEqual(self.pkcs11.decrypt.call_count, 1)
self.assertEqual(self.pkcs11.return_session.call_count, 1)
self.assertEqual(2, self.pkcs11.get_key_handle.call_count)
self.assertEqual(2, self.pkcs11.get_session.call_count)
self.assertEqual(1, self.pkcs11.verify_hmac.call_count)
self.assertEqual(1, self.pkcs11.unwrap_key.call_count)
self.assertEqual(1, self.pkcs11.decrypt.call_count)
self.assertEqual(1, self.pkcs11.return_session.call_count)
def test_decrypt_bad_session(self):
self.pkcs11.get_session.return_value = mock.DEFAULT
@ -199,12 +199,12 @@ class WhenTestingP11CryptoPlugin(utils.BaseTestCase):
kek_meta_extended,
mock.MagicMock())
self.assertEqual(self.pkcs11.get_key_handle.call_count, 2)
self.assertEqual(self.pkcs11.get_session.call_count, 2)
self.assertEqual(self.pkcs11.verify_hmac.call_count, 1)
self.assertEqual(self.pkcs11.unwrap_key.call_count, 1)
self.assertEqual(self.pkcs11.decrypt.call_count, 0)
self.assertEqual(self.pkcs11.return_session.call_count, 0)
self.assertEqual(2, self.pkcs11.get_key_handle.call_count)
self.assertEqual(2, self.pkcs11.get_session.call_count)
self.assertEqual(1, self.pkcs11.verify_hmac.call_count)
self.assertEqual(1, self.pkcs11.unwrap_key.call_count)
self.assertEqual(0, self.pkcs11.decrypt.call_count)
self.assertEqual(0, self.pkcs11.return_session.call_count)
def test_generate_symmetric(self):
secret = models.Secret()
@ -225,16 +225,16 @@ class WhenTestingP11CryptoPlugin(utils.BaseTestCase):
kek_meta,
mock.MagicMock())
self.assertEqual(response_dto.cypher_text, b'0')
self.assertEqual(b'0', response_dto.cypher_text)
self.assertIn('iv', response_dto.kek_meta_extended)
self.assertEqual(self.pkcs11.get_key_handle.call_count, 2)
self.assertEqual(self.pkcs11.get_session.call_count, 2)
self.assertEqual(self.pkcs11.generate_random.call_count, 1)
self.assertEqual(self.pkcs11.verify_hmac.call_count, 1)
self.assertEqual(self.pkcs11.unwrap_key.call_count, 1)
self.assertEqual(self.pkcs11.encrypt.call_count, 1)
self.assertEqual(self.pkcs11.return_session.call_count, 1)
self.assertEqual(2, self.pkcs11.get_key_handle.call_count)
self.assertEqual(2, self.pkcs11.get_session.call_count)
self.assertEqual(1, self.pkcs11.generate_random.call_count)
self.assertEqual(1, self.pkcs11.verify_hmac.call_count)
self.assertEqual(1, self.pkcs11.unwrap_key.call_count)
self.assertEqual(1, self.pkcs11.encrypt.call_count)
self.assertEqual(1, self.pkcs11.return_session.call_count)
def test_generate_asymmetric_raises_error(self):
self.assertRaises(NotImplementedError,
@ -283,39 +283,39 @@ class WhenTestingP11CryptoPlugin(utils.BaseTestCase):
self.pkcs11.get_key_handle.return_value = None
mkek = self.plugin._generate_mkek(256, 'mkek_label_2')
self.assertEqual(mkek, 3)
self.assertEqual(3, mkek)
self.assertEqual(self.pkcs11.get_key_handle.call_count, 3)
self.assertEqual(self.pkcs11.generate_key.call_count, 1)
self.assertEqual(3, self.pkcs11.get_key_handle.call_count)
self.assertEqual(1, self.pkcs11.generate_key.call_count)
def test_cached_generate_mkek(self):
self.assertRaises(ex.P11CryptoPluginKeyException,
self.plugin._generate_mkek, 256, 'mkek_label')
self.assertEqual(self.pkcs11.get_key_handle.call_count, 2)
self.assertEqual(2, self.pkcs11.get_key_handle.call_count)
def test_existing_generate_mkek(self):
self.assertRaises(ex.P11CryptoPluginKeyException,
self.plugin._generate_mkek, 256, 'mkek2_label')
self.assertEqual(self.pkcs11.get_key_handle.call_count, 3)
self.assertEqual(3, self.pkcs11.get_key_handle.call_count)
def test_generate_mkhk(self):
self.pkcs11.get_key_handle.return_value = None
mkhk = self.plugin._generate_mkhk(256, 'mkhk_label_2')
self.assertEqual(mkhk, 3)
self.assertEqual(3, mkhk)
self.assertEqual(self.pkcs11.get_key_handle.call_count, 3)
self.assertEqual(self.pkcs11.generate_key.call_count, 1)
self.assertEqual(3, self.pkcs11.get_key_handle.call_count)
self.assertEqual(1, self.pkcs11.generate_key.call_count)
def test_cached_generate_mkhk(self):
self.assertRaises(ex.P11CryptoPluginKeyException,
self.plugin._generate_mkhk, 256, 'hmac_label')
self.assertEqual(self.pkcs11.get_key_handle.call_count, 2)
self.assertEqual(2, self.pkcs11.get_key_handle.call_count)
def test_existing_generate_mkhk(self):
self.assertRaises(ex.P11CryptoPluginKeyException,
self.plugin._generate_mkhk, 256, 'mkhk2_label')
self.assertEqual(self.pkcs11.get_key_handle.call_count, 3)
self.assertEqual(3, self.pkcs11.get_key_handle.call_count)
def test_create_pkcs11(self):
def _generate_random(session, buf, length):
@ -368,10 +368,10 @@ class WhenTestingP11CryptoPlugin(utils.BaseTestCase):
self.plugin.encrypt(mock.MagicMock(), mock.MagicMock(),
mock.MagicMock())
self.assertEqual(self.pkcs11.get_key_handle.call_count, 2)
self.assertEqual(self.pkcs11.get_session.call_count, 1)
self.assertEqual(self.pkcs11.return_session.call_count, 0)
self.assertEqual(self.plugin._encrypt.call_count, 2)
self.assertEqual(2, self.pkcs11.get_key_handle.call_count)
self.assertEqual(1, self.pkcs11.get_session.call_count)
self.assertEqual(0, self.pkcs11.return_session.call_count)
self.assertEqual(2, self.plugin._encrypt.call_count)
def test_reinitialize_pkcs11(self):
pkcs11 = self.pkcs11
@ -382,9 +382,9 @@ class WhenTestingP11CryptoPlugin(utils.BaseTestCase):
self.plugin._reinitialize_pkcs11()
self.assertEqual(self.pkcs11.finalize.call_count, 1)
self.assertEqual(self.plugin._create_pkcs11.call_count, 1)
self.assertEqual(self.plugin._configure_object_cache.call_count, 1)
self.assertEqual(1, self.pkcs11.finalize.call_count)
self.assertEqual(1, self.plugin._create_pkcs11.call_count)
self.assertEqual(1, self.plugin._configure_object_cache.call_count)
def test_get_plugin_name(self):
self.assertEqual(self.plugin_name, self.plugin.get_plugin_name())

@ -142,19 +142,19 @@ class WhenTestingPKCS11(utils.BaseTestCase):
self.lib.C_GetSessionInfo.side_effect = self._get_session_public
sess = self.pkcs11.get_session()
self.assertEqual(sess, 1)
self.assertEqual(1, sess)
self.assertEqual(self.lib.C_OpenSession.call_count, 2)
self.assertEqual(self.lib.C_GetSessionInfo.call_count, 2)
self.assertEqual(self.lib.C_Login.call_count, 1)
self.assertEqual(self.lib.C_CloseSession.call_count, 1)
self.assertEqual(2, self.lib.C_OpenSession.call_count)
self.assertEqual(2, self.lib.C_GetSessionInfo.call_count)
self.assertEqual(1, self.lib.C_Login.call_count)
self.assertEqual(1, self.lib.C_CloseSession.call_count)
def test_user_get_session(self):
self.pkcs11.get_session()
self.assertEqual(self.lib.C_OpenSession.call_count, 2)
self.assertEqual(self.lib.C_GetSessionInfo.call_count, 2)
self.assertEqual(self.lib.C_Login.call_count, 0)
self.assertEqual(2, self.lib.C_OpenSession.call_count)
self.assertEqual(2, self.lib.C_GetSessionInfo.call_count)
self.assertEqual(0, self.lib.C_Login.call_count)
def test_seed_random(self):
rd = "random-data"
@ -166,9 +166,9 @@ class WhenTestingPKCS11(utils.BaseTestCase):
def test_generate_random(self):
r = self.pkcs11.generate_random(32, mock.MagicMock())
self.assertEqual(r, b'0' * 32)
self.assertEqual(b'0' * 32, r)
self.assertEqual(self.lib.C_GenerateRandom.call_count, 2)
self.assertEqual(2, self.lib.C_GenerateRandom.call_count)
def test_rng_self_test_fail(self):
def _bad_generate_random(session, buf, length):
@ -181,11 +181,11 @@ class WhenTestingPKCS11(utils.BaseTestCase):
def test_get_key_handle_one_key(self):
key = self.pkcs11.get_key_handle('foo', mock.MagicMock())
self.assertEqual(key, 2)
self.assertEqual(2, key)
self.assertEqual(self.lib.C_FindObjectsInit.call_count, 1)
self.assertEqual(self.lib.C_FindObjects.call_count, 1)
self.assertEqual(self.lib.C_FindObjectsFinal.call_count, 1)
self.assertEqual(1, self.lib.C_FindObjectsInit.call_count)
self.assertEqual(1, self.lib.C_FindObjects.call_count)
self.assertEqual(1, self.lib.C_FindObjectsFinal.call_count)
def test_get_key_handle_no_keys(self):
self.lib.C_FindObjects.side_effect = self._find_objects_zero
@ -193,9 +193,9 @@ class WhenTestingPKCS11(utils.BaseTestCase):
self.assertIsNone(key)
self.assertEqual(self.lib.C_FindObjectsInit.call_count, 1)
self.assertEqual(self.lib.C_FindObjects.call_count, 1)
self.assertEqual(self.lib.C_FindObjectsFinal.call_count, 1)
self.assertEqual(1, self.lib.C_FindObjectsInit.call_count)
self.assertEqual(1, self.lib.C_FindObjects.call_count)
self.assertEqual(1, self.lib.C_FindObjectsFinal.call_count)
def test_get_key_handle_multiple_keys(self):
self.lib.C_FindObjects.side_effect = self._find_objects_two
@ -203,24 +203,24 @@ class WhenTestingPKCS11(utils.BaseTestCase):
self.assertRaises(exception.P11CryptoPluginKeyException,
self.pkcs11.get_key_handle, 'foo', mock.MagicMock())
self.assertEqual(self.lib.C_FindObjectsInit.call_count, 1)
self.assertEqual(self.lib.C_FindObjects.call_count, 1)
self.assertEqual(self.lib.C_FindObjectsFinal.call_count, 1)
self.assertEqual(1, self.lib.C_FindObjectsInit.call_count)
self.assertEqual(1, self.lib.C_FindObjects.call_count)
self.assertEqual(1, self.lib.C_FindObjectsFinal.call_count)
def test_generate_session_key(self):
key = self.pkcs11.generate_key(16, mock.MagicMock(), encrypt=True)
self.assertEqual(key, 3)
self.assertEqual(3, key)
self.assertEqual(self.lib.C_GenerateKey.call_count, 1)
self.assertEqual(1, self.lib.C_GenerateKey.call_count)
def test_generate_master_key(self):
key = self.pkcs11.generate_key(16, mock.MagicMock(), key_label='key',
encrypt=True, master_key=True)
self.assertEqual(key, 3)
self.assertEqual(3, key)
self.assertEqual(self.lib.C_GenerateKey.call_count, 1)
self.assertEqual(1, self.lib.C_GenerateKey.call_count)
def test_generate_key_no_flags(self):
self.assertRaises(exception.P11CryptoPluginException,
@ -239,9 +239,9 @@ class WhenTestingPKCS11(utils.BaseTestCase):
self.assertEqual(ct['ct'][:len(pt)], pt[::-1])
self.assertGreater(len(ct['iv']), 0)
self.assertEqual(self.lib.C_GenerateRandom.call_count, 1)
self.assertEqual(self.lib.C_EncryptInit.call_count, 1)
self.assertEqual(self.lib.C_Encrypt.call_count, 1)
self.assertEqual(1, self.lib.C_GenerateRandom.call_count)
self.assertEqual(1, self.lib.C_EncryptInit.call_count)
self.assertEqual(1, self.lib.C_Encrypt.call_count)
def test_decrypt(self):
ct = b'FEDCBA9876543210' + b'0' * self.pkcs11.gcmtagsize
@ -251,8 +251,8 @@ class WhenTestingPKCS11(utils.BaseTestCase):
pt_len = len(ct) - self.pkcs11.gcmtagsize
self.assertEqual(pt[:pt_len], ct[:-self.pkcs11.gcmtagsize][::-1])
self.assertEqual(self.lib.C_DecryptInit.call_count, 1)
self.assertEqual(self.lib.C_Decrypt.call_count, 1)
self.assertEqual(1, self.lib.C_DecryptInit.call_count)
self.assertEqual(1, self.lib.C_Decrypt.call_count)
def test_decrypt_with_pad(self):
ct = b'\x03\x03\x03CBA9876543210' + b'0' * self.pkcs11.gcmtagsize
@ -262,8 +262,8 @@ class WhenTestingPKCS11(utils.BaseTestCase):
pt_len = len(ct) - self.pkcs11.gcmtagsize - 3
self.assertEqual(pt[:pt_len], ct[3:-self.pkcs11.gcmtagsize][::-1])
self.assertEqual(self.lib.C_DecryptInit.call_count, 1)
self.assertEqual(self.lib.C_Decrypt.call_count, 1)
self.assertEqual(1, self.lib.C_DecryptInit.call_count)
self.assertEqual(1, self.lib.C_Decrypt.call_count)
def test_decrypt_with_pad_new_iv(self):
ct = b'\x03\x03\x03CBA9876543210' + b'0' * self.pkcs11.gcmtagsize
@ -273,8 +273,8 @@ class WhenTestingPKCS11(utils.BaseTestCase):
pt_len = len(ct) - self.pkcs11.gcmtagsize
self.assertEqual(pt[:pt_len], ct[:-self.pkcs11.gcmtagsize][::-1])
self.assertEqual(self.lib.C_DecryptInit.call_count, 1)
self.assertEqual(self.lib.C_Decrypt.call_count, 1)
self.assertEqual(1, self.lib.C_DecryptInit.call_count)
self.assertEqual(1, self.lib.C_Decrypt.call_count)
def test_decrypt_with_pad_wrong_size(self):
ct = b'\x03\x03\x03CBA987654321' + b'0' * self.pkcs11.gcmtagsize
@ -284,8 +284,8 @@ class WhenTestingPKCS11(utils.BaseTestCase):
pt_len = len(ct) - self.pkcs11.gcmtagsize
self.assertEqual(pt[:pt_len], ct[:-self.pkcs11.gcmtagsize][::-1])
self.assertEqual(self.lib.C_DecryptInit.call_count, 1)
self.assertEqual(self.lib.C_Decrypt.call_count, 1)
self.assertEqual(1, self.lib.C_DecryptInit.call_count)
self.assertEqual(1, self.lib.C_Decrypt.call_count)
def test_decrypt_with_pad_wrong_length(self):
ct = b'\x03EDCBA9876543210' + b'0' * self.pkcs11.gcmtagsize
@ -295,8 +295,8 @@ class WhenTestingPKCS11(utils.BaseTestCase):
pt_len = len(ct) - self.pkcs11.gcmtagsize
self.assertEqual(pt[:pt_len], ct[:-self.pkcs11.gcmtagsize][::-1])
self.assertEqual(self.lib.C_DecryptInit.call_count, 1)
self.assertEqual(self.lib.C_Decrypt.call_count, 1)
self.assertEqual(1, self.lib.C_DecryptInit.call_count)
self.assertEqual(1, self.lib.C_Decrypt.call_count)
def test_decrypt_with_too_large_pad(self):
ct = b'\x11EDCBA9876543210' + b'0' * self.pkcs11.gcmtagsize
@ -306,43 +306,43 @@ class WhenTestingPKCS11(utils.BaseTestCase):
pt_len = len(ct) - self.pkcs11.gcmtagsize
self.assertEqual(pt[:pt_len], ct[:-self.pkcs11.gcmtagsize][::-1])
self.assertEqual(self.lib.C_DecryptInit.call_count, 1)
self.assertEqual(self.lib.C_Decrypt.call_count, 1)
self.assertEqual(1, self.lib.C_DecryptInit.call_count)
self.assertEqual(1, self.lib.C_Decrypt.call_count)
def test_wrap_key(self):
wkek = self.pkcs11.wrap_key(mock.Mock(), mock.Mock(), mock.Mock())
self.assertGreater(len(wkek['iv']), 0)
self.assertEqual(wkek['wrapped_key'], b'0' * 16)
self.assertEqual(b'0' * 16, wkek['wrapped_key'])
self.assertEqual(self.lib.C_GenerateRandom.call_count, 2)
self.assertEqual(self.lib.C_WrapKey.call_count, 2)
self.assertEqual(2, self.lib.C_GenerateRandom.call_count)
self.assertEqual(2, self.lib.C_WrapKey.call_count)
def test_unwrap_key(self):
kek = self.pkcs11.unwrap_key(mock.Mock(), b'0' * 16,
b'0' * 16, mock.Mock())
self.assertEqual(kek, 1)
self.assertEqual(1, kek)
self.assertEqual(self.lib.C_UnwrapKey.call_count, 1)
def test_compute_hmac(self):
buf = self.pkcs11.compute_hmac(mock.MagicMock(), mock.MagicMock(),
mock.MagicMock())
self.assertEqual(len(buf), 32)
self.assertEqual(32, len(buf))
self.assertEqual(self.lib.C_SignInit.call_count, 1)
self.assertEqual(self.lib.C_Sign.call_count, 1)
self.assertEqual(1, self.lib.C_SignInit.call_count)
self.assertEqual(1, self.lib.C_Sign.call_count)
def test_verify_hmac(self):
self.pkcs11.verify_hmac(mock.MagicMock(), mock.MagicMock(),
mock.MagicMock(), mock.MagicMock())
self.assertEqual(self.lib.C_VerifyInit.call_count, 1)
self.assertEqual(self.lib.C_Verify.call_count, 1)
self.assertEqual(1, self.lib.C_VerifyInit.call_count)
self.assertEqual(1, self.lib.C_Verify.call_count)
def test_destroy_object(self):
self.pkcs11.destroy_object(mock.MagicMock(), mock.MagicMock())
self.assertEqual(self.lib.C_DestroyObject.call_count, 1)
self.assertEqual(1, self.lib.C_DestroyObject.call_count)
def test_invalid_build_attributes(self):
self.assertRaises(TypeError, self.pkcs11._build_attributes,
@ -351,7 +351,7 @@ class WhenTestingPKCS11(utils.BaseTestCase):
def test_finalize(self):
self.pkcs11.finalize()
self.assertEqual(self.lib.C_Finalize.call_count, 1)
self.assertEqual(1, self.lib.C_Finalize.call_count)
def test_check_error(self):
self.assertIsNone(self.pkcs11._check_error(pkcs11.CKR_OK))

@ -128,7 +128,7 @@ class PagingTestCase(TestCase):
detect duplicates across multiple calls)
"""
self.assertIsNotNone(resources)
self.assertEqual(len(resources), expected_size)
self.assertEqual(expected_size, len(resources))
self.assertEqual(next_ref_should_be_none, next_ref is None)
self.assertEqual(prev_ref_should_be_none, prev_ref is None)
@ -139,7 +139,7 @@ class PagingTestCase(TestCase):
if len(self._all_fetched_resources):
duplicates = [entity for entity in resources if entity in
self._all_fetched_resources]
self.assertEqual(len(duplicates), 0)
self.assertEqual(0, len(duplicates))
# add to our running list of resource refs
self._all_fetched_resources.extend(resources)

@ -502,7 +502,7 @@ class CertificateAuthoritiesTestCase(CATestCommon):
container_resp = self.container_behaviors.get_container(
order_resp.model.container_ref)
self.assertEqual(container_resp.status_code, 200)
self.assertEqual(200, container_resp.status_code)
secret_dict = {}
for secret in container_resp.model.secret_refs:
@ -551,7 +551,7 @@ class ListingCAsTestCase(CATestCommon):
are specifically loaded.
"""
(resp, cas, total, next_ref, prev_ref) = self.ca_behaviors.get_cas()
self.assertEqual(total, 2)
self.assertEqual(2, total)
@depends_on_ca_plugins('dogtag')
def test_list_dogtag_cas(self):
@ -569,7 +569,7 @@ class ProjectCATestCase(CATestCommon):
def test_addition_of_project_ca_affects_getting_ca_list(self):
# Getting list of CAs should get the total configured CAs
(resp, cas, initial_total, _, __) = self.ca_behaviors.get_cas()
self.assertEqual(initial_total, 2)
self.assertEqual(2, initial_total)
# Set project CA
ca_ref = self.get_snakeoil_root_ca_ref()

@ -196,7 +196,7 @@ class CertificatesTestCase(base.TestCase):
test_model.secret_refs = [pub_key_ref, priv_key_ref]
resp, container_ref = self.container_behaviors.create_container(
test_model)
self.assertEqual(resp.status_code, 201)
self.assertEqual(201, resp.status_code)
return container_ref
@ -212,7 +212,7 @@ class CertificatesTestCase(base.TestCase):
'secret_ref': secret_ref
}]
resp, container_ref = self.container_behaviors.create_container(test_model)
self.assertEqual(resp.status_code, 201)
self.assertEqual(201, resp.status_code)
return container_ref
def get_dogtag_ca_id(self):
@ -484,7 +484,7 @@ class CertificatesTestCase(base.TestCase):
test_model = order_models.OrderModel(**self.simple_cmc_data)
create_resp, order_ref = self.behaviors.create_order(test_model)
self.assertEqual(create_resp.status_code, 400)
self.assertEqual(400, create_resp.status_code)
self.assertIsNone(order_ref)
self.confirm_error_message(
create_resp,
@ -498,7 +498,7 @@ class CertificatesTestCase(base.TestCase):
certutil.create_good_csr())
create_resp, order_ref = self.behaviors.create_order(test_model)
self.assertEqual(create_resp.status_code, 400)
self.assertEqual(400, create_resp.status_code)
self.assertIsNone(order_ref)
self.confirm_error_message(
create_resp,
@ -729,7 +729,7 @@ class CertificatesTestCase(base.TestCase):
certutil.create_good_csr())
create_resp, order_ref = self.behaviors.create_order(test_model)
self.assertEqual(create_resp.status_code, 202)
self.assertEqual(202, create_resp.status_code)
self.assertIsNotNone(order_ref)
order_resp = self.wait_for_order(order_ref)

@ -80,7 +80,7 @@ class ConsumersBaseTestCase(base.TestCase):
def _create_a_secret(self):
secret_model = secret_models.SecretModel(**create_secret_data)
resp, secret_ref = self.secret_behaviors.create_secret(secret_model)
self.assertEqual(resp.status_code, 201)
self.assertEqual(201, resp.status_code)
self.assertIsNotNone(secret_ref)
return secret_ref
@ -108,7 +108,7 @@ class ConsumersBaseTestCase(base.TestCase):
resp, container_ref = self.container_behaviors.create_container(
container_model
)
self.assertEqual(resp.status_code, 201)
self.assertEqual(201, resp.status_code)
self.assertIsNotNone(container_ref)
return container_ref
@ -128,13 +128,13 @@ class ConsumersCertContainerTestCase(ConsumersBaseTestCase):
resp, consumer_data = self.consumer_behaviors.create_consumer(
self.consumer_test_model, container_ref)
self.assertEqual(resp.status_code, 200)
self.assertEqual(200, resp.status_code)
self.assertIsNotNone(consumer_data)
return consumer_data
def _get_decrypted_secrets_from_container(self, container_href):
get_resp = self.container_behaviors.get_container(container_href)
self.assertEqual(get_resp.status_code, 200)
self.assertEqual(200, get_resp.status_code)
private_key_ref = get_resp.model.secret_refs[0].secret_ref
tls_cert_ref = get_resp.model.secret_refs[1].secret_ref
@ -186,7 +186,7 @@ class ConsumersCertContainerTestCase(ConsumersBaseTestCase):
resp, container_ref = self.container_behaviors.create_container(
test_model)
self.assertEqual(resp.status_code, 201)
self.assertEqual(201, resp.status_code)
self.assertIsNotNone(container_ref)
return container_ref
@ -194,7 +194,7 @@ class ConsumersCertContainerTestCase(ConsumersBaseTestCase):
resp, consumer_data = self.consumer_behaviors.delete_consumer(
self.consumer_test_model, container_ref
)
self.assertEqual(resp.status_code, 200)
self.assertEqual(200, resp.status_code)
self.assertIsNotNone(consumer_data)
self.assertNotIn(self.consumer_test_model.name, consumer_data)
self.assertNotIn(self.consumer_test_model.URL, consumer_data)

@ -120,7 +120,7 @@ class BaseContainerTestCase(base.TestCase):
secret_model = secret_models.SecretModel(**secret_defaults_data)
resp, secret_ref = self.secret_behaviors.create_secret(secret_model)
self.assertEqual(resp.status_code, 201)
self.assertEqual(201, resp.status_code)
self.assertIsNotNone(secret_ref)
return secret_ref
@ -136,7 +136,7 @@ class GenericContainersTestCase(BaseContainerTestCase):
test_model.name = None
resp, container_ref = self.behaviors.create_container(test_model)
self.assertEqual(resp.status_code, 201)
self.assertEqual(201, resp.status_code)
@utils.parameterized_dataset({'0': [0], '1': [1], '50': [50]})
@testcase.attr('positive')
@ -151,7 +151,7 @@ class GenericContainersTestCase(BaseContainerTestCase):
})
resp, container_ref = self.behaviors.create_container(test_model)
self.assertEqual(resp.status_code, 201)
self.assertEqual(201, resp.status_code)
@utils.parameterized_dataset(accepted_str_values)
@testcase.attr('positive')
@ -161,7 +161,7 @@ class GenericContainersTestCase(BaseContainerTestCase):
test_model.name = name
resp, container_ref = self.behaviors.create_container(test_model)
self.assertEqual(resp.status_code, 201)
self.assertEqual(201, resp.status_code)
@utils.parameterized_dataset(accepted_str_values)
@testcase.attr('positive')
@ -174,10 +174,10 @@ class GenericContainersTestCase(BaseContainerTestCase):
}]
resp, container_ref = self.behaviors.create_container(test_model)
self.assertEqual(resp.status_code, 201)
self.assertEqual(201, resp.status_code)
get_resp = self.behaviors.get_container(container_ref)
self.assertEqual(get_resp.status_code, 200)
self.assertEqual(200, get_resp.status_code)
self.assertEqual(get_resp.model.secret_refs[0].name, name)
@testcase.attr('negative')
@ -187,7 +187,7 @@ class GenericContainersTestCase(BaseContainerTestCase):
test_model.type = 'bad_type'
resp, container_ref = self.behaviors.create_container(test_model)
self.assertEqual(resp.status_code, 400)
self.assertEqual(400, resp.status_code)
@testcase.attr('negative')
def test_create_defaults_duplicate_secret_refs(self):
@ -198,19 +198,19 @@ class GenericContainersTestCase(BaseContainerTestCase):
test_model.secret_refs[2]['secret_ref'] = self.secret_ref_1
resp, container_ref = self.behaviors.create_container(test_model)
self.assertEqual(resp.status_code, 400)
self.assertEqual(400, resp.status_code)
@testcase.attr('negative')
def test_get_non_existent_container(self):
"""A get on a container that does not exist should return a 404."""
resp = self.behaviors.get_container("not_a_ref")
self.assertEqual(resp.status_code, 404)
self.assertEqual(404, resp.status_code)
@testcase.attr('negative')
def test_delete_non_existent_container(self):
"""A delete on a container that does not exist should return a 404."""
resp = self.behaviors.delete_container("not_a_ref", expected_fail=True)
self.assertEqual(resp.status_code, 404)
self.assertEqual(404, resp.status_code)
@testcase.skipIf(not base.conf_host_href_used, 'response href using '
'wsgi request instead of CONF.host_href')
@ -226,7 +226,7 @@ class GenericContainersTestCase(BaseContainerTestCase):
resp, container_ref = self.behaviors.create_container(
test_model, extra_headers=changed_host_header)
self.assertEqual(resp.status_code, 201)
self.assertEqual(201, resp.status_code)
# get Location field from result and assert that it is NOT the
# malicious one.
@ -248,7 +248,7 @@ class GenericContainersTestCase(BaseContainerTestCase):
# container_href in response contains that host in url. That url is
# used in deleting that container during cleanup step.
resp, container_href = self.behaviors.create_container(test_model)
self.assertEqual(resp.status_code, 201)
self.assertEqual(201, resp.status_code)
resp = self.behaviors.get_container(container_href,
extra_headers=changed_host_header)
@ -271,7 +271,7 @@ class RSAContainersTestCase(BaseContainerTestCase):
test_model.secret_refs = [pub_key_ref, priv_key_ref]
resp, container_ref = self.behaviors.create_container(test_model)
self.assertEqual(resp.status_code, 201)
self.assertEqual(201, resp.status_code)
@utils.parameterized_dataset(accepted_str_values)
@testcase.attr('positive')
@ -281,7 +281,7 @@ class RSAContainersTestCase(BaseContainerTestCase):
test_model.name = name
resp, container_ref = self.behaviors.create_container(test_model)
self.assertEqual(resp.status_code, 201)
self.assertEqual(201, resp.status_code)
@testcase.attr('negative')
def test_create_rsa_invalid_key_names(self):
@ -303,7 +303,7 @@ class RSAContainersTestCase(BaseContainerTestCase):
]
resp, container_ref = self.behaviors.create_container(test_model)
self.assertEqual(resp.status_code, 400)
self.assertEqual(400, resp.status_code)
@testcase.attr('negative')
def test_create_rsa_no_public_key(self):
@ -315,7 +315,7 @@ class RSAContainersTestCase(BaseContainerTestCase):
test_model.secret_refs[0]['name'] = 'secret_1'
resp, container_ref = self.behaviors.create_container(test_model)
self.assertEqual(resp.status_code, 400)
self.assertEqual(400, resp.status_code)
@testcase.attr('negative')
def test_create_rsa_no_private_key(self):
@ -327,7 +327,7 @@ class RSAContainersTestCase(BaseContainerTestCase):
test_model.secret_refs[1]['name'] = 'secret_1'
resp, container_ref = self.behaviors.create_container(test_model)
self.assertEqual(resp.status_code, 400)
self.assertEqual(400, resp.status_code)
@testcase.skipIf(not base.conf_host_href_used, 'response href using '
'wsgi request instead of CONF.host_href')
@ -343,7 +343,7 @@ class RSAContainersTestCase(BaseContainerTestCase):
resp, container_ref = self.behaviors.create_container(
test_model, extra_headers=changed_host_header)
self.assertEqual(resp.status_code, 201)
self.assertEqual(201, resp.status_code)
# get Location field from result and assert that it is NOT the
# malicious one.
@ -365,7 +365,7 @@ class RSAContainersTestCase(BaseContainerTestCase):
# container_href in response contains that host in url. That url is
# used in deleting that container during cleanup step.
resp, container_href = self.behaviors.create_container(test_model)
self.assertEqual(resp.status_code, 201)
self.assertEqual(201, resp.status_code)
resp = self.behaviors.get_container(container_href,
extra_headers=changed_host_header)
@ -400,7 +400,7 @@ class ContainersPagingTestCase(base.PagingTestCase):
secret_model = secret_models.SecretModel(**secret_defaults_data)
resp, secret_ref = self.secret_behaviors.create_secret(secret_model)
self.assertEqual(resp.status_code, 201)
self.assertEqual(201, resp.status_code)
self.assertIsNotNone(secret_ref)
return secret_ref

@ -109,7 +109,7 @@ class OrdersTestCase(base.TestCase):
test_model.name = None
create_resp, order_ref = self.behaviors.create_order(test_model)
self.assertEqual(create_resp.status_code, 202)
self.assertEqual(202, create_resp.status_code)
self.assertIsNotNone(order_ref)
@testcase.attr('positive')
@ -120,7 +120,7 @@ class OrdersTestCase(base.TestCase):
test_model.name = ""
create_resp, order_ref = self.behaviors.create_order(test_model)
self.assertEqual(create_resp.status_code, 202)
self.assertEqual(202, create_resp.status_code)
self.assertIsNotNone(order_ref)
@testcase.attr('positive')
@ -137,14 +137,14 @@ class OrdersTestCase(base.TestCase):
create_resp, order_ref = self.behaviors.create_order(test_model)
# verify that the order was created successfully
self.assertEqual(create_resp.status_code, 202)
self.assertEqual(202, create_resp.status_code)
self.assertIsNotNone(order_ref)
# given the order href, retrieve the order
order_resp = self.behaviors.get_order(order_ref)
# verify that the get was successful
self.assertEqual(order_resp.status_code, 200)
self.assertEqual(200, order_resp.status_code)
self.assertTrue(order_resp.model.status == "ACTIVE" or
order_resp.model.status == "PENDING")
@ -156,7 +156,7 @@ class OrdersTestCase(base.TestCase):
# in the newly created order.
secret_resp = self.secret_behaviors.get_secret_metadata(
order_resp.model.secret_ref)
self.assertEqual(secret_resp.status_code, 200)
self.assertEqual(200, secret_resp.status_code)
self.assertEqual(secret_resp.model.name, test_model.meta['name'])
@testcase.attr('negative')
@ -169,10 +169,10 @@ class OrdersTestCase(base.TestCase):
test_model = order_models.OrderModel(**self.create_default_data)
resp, order_ref = self.behaviors.create_order(test_model)
self.assertEqual(resp.status_code, 202)
self.assertEqual(202, resp.status_code)
order_resp = self.behaviors.get_order(order_ref)
self.assertEqual(order_resp.status_code, 200)
self.assertEqual(200, order_resp.status_code)
# PENDING orders may take a moment to be processed by the workers
# when running tests with queue enabled
@ -182,7 +182,7 @@ class OrdersTestCase(base.TestCase):
secret_resp = self.secret_behaviors.get_secret(
secret_ref, payload_content_type="text/plain")
self.assertEqual(secret_resp.status_code, 406)
self.assertEqual(406, secret_resp.status_code)
@testcase.attr('positive')
def test_order_and_secret_metadata_same(self):
@ -195,10 +195,10 @@ class OrdersTestCase(base.TestCase):
test_model = order_models.OrderModel(**self.create_default_data)
resp, order_ref = self.behaviors.create_order(test_model)
self.assertEqual(resp.status_code, 202)
self.assertEqual(202, resp.status_code)
order_resp = self.behaviors.get_order(order_ref)
self.assertEqual(order_resp.status_code, 200)
self.assertEqual(200, order_resp.status_code)
# PENDING orders may take a moment to be processed by the workers
# when running tests with queue enabled
@ -232,7 +232,7 @@ class OrdersTestCase(base.TestCase):
order_resp = self.behaviors.get_order("a ref that does not exist")
# verify that the order get failed
self.assertEqual(order_resp.status_code, 404)
self.assertEqual(404, order_resp.status_code)
@testcase.attr('negative')
def test_order_create_w_invalid_content_type(self):
@ -243,7 +243,7 @@ class OrdersTestCase(base.TestCase):
create_resp, order_ref = self.behaviors.create_order(
test_model, extra_headers=extra_headers)
self.assertEqual(create_resp.status_code, 415)
self.assertEqual(415, create_resp.status_code)
self.assertIsNone(order_ref)
@testcase.attr('negative')
@ -253,7 +253,7 @@ class OrdersTestCase(base.TestCase):
test_model = order_models.OrderModel(**self.create_all_none_data)
create_resp, order_ref = self.behaviors.create_order(test_model)
self.assertEqual(create_resp.status_code, 400)
self.assertEqual(400, create_resp.status_code)
self.assertIsNone(order_ref)
@testcase.attr('negative')
@ -269,7 +269,7 @@ class OrdersTestCase(base.TestCase):
create_resp, order_ref = self.behaviors.create_order(test_model)
self.assertEqual(create_resp.status_code, 400)
self.assertEqual(400, create_resp.status_code)
self.assertIsNone(order_ref)
@testcase.attr('negative')
@ -283,7 +283,7 @@ class OrdersTestCase(base.TestCase):
create_resp, order_ref = self.behaviors.create_order(test_model)
self.assertEqual(create_resp.status_code, 400)
self.assertEqual(400, create_resp.status_code)
self.assertIsNone(order_ref)
@testcase.attr('negative')
@ -297,7 +297,7 @@ class OrdersTestCase(base.TestCase):
# Make sure we actually get a message back
error_msg = json.loads(resp.content).get('title')
self.assertEqual(resp.status_code, 400)
self.assertEqual(400, resp.status_code)
self.assertIsNotNone(error_msg)
self.assertNotEqual(error_msg, 'None')
@ -318,7 +318,7 @@ class OrdersTestCase(base.TestCase):
test_model.meta['bit_length'] = bit_length
create_resp, order_ref = self.behaviors.create_order(test_model)
self.assertEqual(create_resp.status_code, 202)
self.assertEqual(202, create_resp.status_code)
self.assertIsNotNone(order_ref)
@utils.parameterized_dataset({
@ -341,7 +341,7 @@ class OrdersTestCase(base.TestCase):
test_model.meta['bit_length'] = bit_length
create_resp, order_ref = self.behaviors.create_order(test_model)
self.assertEqual(create_resp.status_code, 400)
self.assertEqual(400, create_resp.status_code)
@utils.parameterized_dataset({
'array': [['array']],
@ -357,7 +357,7 @@ class OrdersTestCase(base.TestCase):
test_model.meta['payload'] = payload
create_resp, order_ref = self.behaviors.create_order(test_model)
self.assertEqual(create_resp.status_code, 400)
self.assertEqual(400, create_resp.status_code)
@utils.parameterized_dataset({
'alphanumeric': ['1f34ds'],
@ -373,7 +373,7 @@ class OrdersTestCase(base.TestCase):
test_model.meta['name'] = name
create_resp, order_ref = self.behaviors.create_order(test_model)
self.assertEqual(create_resp.status_code, 202)
self.assertEqual(202, create_resp.status_code)
self.assertIsNotNone(order_ref)
@utils.parameterized_dataset({
@ -386,7 +386,7 @@ class OrdersTestCase(base.TestCase):
test_model.meta['name'] = name
create_resp, order_ref = self.behaviors.create_order(test_model)
self.assertEqual(create_resp.status_code, 400)
self.assertEqual(400, create_resp.status_code)
@utils.parameterized_dataset({
'cbc': ['cbc']
@ -398,7 +398,7 @@ class OrdersTestCase(base.TestCase):
test_model.meta['mode'] = mode
create_resp, order_ref = self.behaviors.create_order(test_model)
self.assertEqual(create_resp.status_code, 202)
self.assertEqual(202, create_resp.status_code)
self.assertIsNotNone(order_ref)
@utils.parameterized_dataset({
@ -411,7 +411,7 @@ class OrdersTestCase(base.TestCase):
test_model.meta['mode'] = mode
create_resp, order_ref = self.behaviors.create_order(test_model)
self.assertEqual(create_resp.status_code, 400)
self.assertEqual(400, create_resp.status_code)
@utils.parameterized_dataset({
'aes': ['aes']
@ -423,7 +423,7 @@ class OrdersTestCase(base.TestCase):
test_model.meta['algorithm'] = algorithm
create_resp, order_ref = self.behaviors.create_order(test_model)
self.assertEqual(create_resp.status_code, 202)
self.assertEqual(202, create_resp.status_code)
self.assertIsNotNone(order_ref)
@utils.parameterized_dataset({
@ -436,7 +436,7 @@ class OrdersTestCase(base.TestCase):
test_model.meta['algorithm'] = algorithm
create_resp, order_ref = self.behaviors.create_order(test_model)
self.assertEqual(create_resp.status_code, 400)
self.assertEqual(400, create_resp.status_code)
@utils.parameterized_dataset({
'empty': [''],
@ -450,7 +450,7 @@ class OrdersTestCase(base.TestCase):
test_model.meta['payload_content_type'] = pct
create_resp, order_ref = self.behaviors.create_order(test_model)
self.assertEqual(create_resp.status_code, 202)
self.assertEqual(202, create_resp.status_code)
self.assertIsNotNone(order_ref)
@utils.parameterized_dataset({
@ -467,7 +467,7 @@ class OrdersTestCase(base.TestCase):
test_model.meta['payload_content_type'] = pct
create_resp, order_ref = self.behaviors.create_order(test_model)
self.assertEqual(create_resp.status_code, 400)
self.assertEqual(400, create_resp.status_code)
@utils.parameterized_dataset({
'negative_five_long_expire': {
@ -494,7 +494,7 @@ class OrdersTestCase(base.TestCase):
test_model.meta['expiration'] = timestamp
create_resp, order_ref = self.behaviors.create_order(test_model)
self.assertEqual(create_resp.status_code, 202)
self.assertEqual(202, create_resp.status_code)
self.assertIsNotNone(order_ref)
@utils.parameterized_dataset({
@ -510,7 +510,7 @@ class OrdersTestCase(base.TestCase):
test_model.meta['expiration'] = timestamp
create_resp, order_ref = self.behaviors.create_order(test_model)
self.assertEqual(create_resp.status_code, 400)
self.assertEqual(400, create_resp.status_code)
@testcase.skipIf(not base.conf_host_href_used, 'response href using '
'wsgi request instead of CONF.host_href')
@ -526,7 +526,7 @@ class OrdersTestCase(base.TestCase):
resp, order_ref = self.behaviors.create_order(
test_model, extra_headers=changed_host_header)
self.assertEqual(resp.status_code, 202)
self.assertEqual(202, resp.status_code)
# get Location field from result and assert that it is NOT the
# malicious one.
@ -548,7 +548,7 @@ class OrdersTestCase(base.TestCase):
# order_ref in response contains that host in url. That url is
# used in deleting that order during cleanup step.
resp, order_ref = self.behaviors.create_order(test_model)
self.assertEqual(resp.status_code, 202)
self.assertEqual(202, resp.status_code)
order_resp = self.behaviors.get_order(
order_ref, extra_headers=changed_host_header)
@ -561,14 +561,14 @@ class OrdersTestCase(base.TestCase):
"""Tests functionality of a generated asymmetric key pair."""
test_model = order_models.OrderModel(**self.asymmetric_data)
create_resp, order_ref = self.behaviors.create_order(test_model)
self.assertEqual(create_resp.status_code, 202)
self.assertEqual(202, create_resp.status_code)
order_resp = self.behaviors.get_order(order_ref)
self.assertEqual(order_resp.status_code, 200)
self.assertEqual(200, order_resp.status_code)
container_resp = self.container_behaviors.get_container(
order_resp.model.container_ref)
self.assertEqual(container_resp.status_code, 200)
self.assertEqual(200, container_resp.status_code)
secret_dict = {}
for secret in container_resp.model.secret_refs:

@ -253,7 +253,7 @@ class QuotaEnforcementTestCase(base.TestCase):
if resp.status_code == 202:
order_resp = self.order_behaviors.get_order(
order_ref, user_name=admin_b)
self.assertEqual(order_resp.status_code, 200)
self.assertEqual(200, order_resp.status_code)
self.order_secrets.append(order_resp.model.secret_ref)
def get_default_consumer_data(self):

@ -72,12 +72,12 @@ class SecretMetadataTestCase(base.TestCase):
**self.default_secret_create_all_none_data)
resp, secret_ref = self.secret_behaviors.create_secret(test_model)
self.assertEqual(resp.status_code, 201)
self.assertEqual(201, resp.status_code)
meta_resp, metadata_ref = self.behaviors.create_or_update_metadata(
secret_ref, self.valid_metadata)
self.assertEqual(meta_resp.status_code, 201)
self.assertEqual(201, meta_resp.status_code)
self.assertEqual(secret_ref + '/metadata', metadata_ref)
@testcase.attr('negative')
@ -87,7 +87,7 @@ class SecretMetadataTestCase(base.TestCase):
meta_resp, metadata_ref = self.behaviors.create_or_update_metadata(
secret_ref, self.invalid_metadata)
self.assertEqual(meta_resp.status_code, 404)
self.assertEqual(404, meta_resp.status_code)
@testcase.attr('positive')
def test_secret_metadata_get(self):
@ -95,16 +95,16 @@ class SecretMetadataTestCase(base.TestCase):
**self.default_secret_create_all_none_data)
resp, secret_ref = self.secret_behaviors.create_secret(test_model)
self.assertEqual(resp.status_code, 201)
self.assertEqual(201, resp.status_code)
meta_resp, metadata_ref = self.behaviors.create_or_update_metadata(
secret_ref, self.valid_metadata)