Exemple #1
0
    def test_barbican_cert_none_values(self):
        container = barbican_client.containers.CertificateContainer(
            api=mock.MagicMock(),
            certificate=None,
            intermediates=None,
            private_key=None,
            private_key_passphrase=None)
        # Create a cert
        cert = bcm.Cert(cert_container=container)

        # Validate the cert functions
        self.assertIsNone(cert.get_certificate())
        self.assertIsNone(cert.get_intermediates())
        self.assertIsNone(cert.get_private_key())
        self.assertIsNone(cert.get_private_key_passphrase())
Exemple #2
0
    def test_barbican_cert(self):
        container = barbican_client.containers.CertificateContainer(
            api=mock.MagicMock(),
            certificate=self.certificate_secret,
            intermediates=self.intermediates_secret,
            private_key=self.private_key_secret,
            private_key_passphrase=self.private_key_passphrase_secret)
        # Create a cert
        cert = bcm.Cert(cert_container=container)

        # Validate the cert functions
        self.assertEqual(self.certificate, cert.get_certificate())
        self.assertEqual(self.intermediates, cert.get_intermediates())
        self.assertEqual(self.private_key, cert.get_private_key())
        self.assertEqual(self.private_key_passphrase,
                         cert.get_private_key_passphrase())