예제 #1
0
    def setUp(self):
        # Make a fake Secret and contents
        self.barbican_endpoint = 'http://localhost:9311/v1'
        self.secret_uuid = uuid.uuid4()

        self.secret_ref = '{0}/secrets/{1}'.format(self.barbican_endpoint,
                                                   self.secret_uuid)

        self.name = 'My Fancy Cert'
        self.secret = secrets.Secret(api=mock.MagicMock(),
                                     payload=sample.PKCS12_BUNDLE)

        self.empty_secret = mock.Mock(spec=secrets.Secret)

        # Mock out the client
        self.bc = mock.Mock()
        barbican_auth = mock.Mock(spec=barbican_common.BarbicanAuth)
        barbican_auth.get_barbican_client.return_value = self.bc

        self.cert_manager = barbican_cert_mgr.BarbicanCertManager()
        self.cert_manager.auth = barbican_auth

        self.context = mock.Mock()
        self.context.project_id = PROJECT_ID

        super(TestBarbicanManager, self).setUp()
예제 #2
0
    def setUp(self):
        # Make a fake Container and contents
        self.barbican_endpoint = 'http://localhost:9311/v1'
        self.container_uuid = uuid.uuid4()

        self.container_ref = '{0}/containers/{1}'.format(
            self.barbican_endpoint, self.container_uuid)

        self.name = 'My Fancy Cert'
        self.certificate = secrets.Secret(api=mock.MagicMock(),
                                          payload=sample.X509_CERT)
        self.intermediates = secrets.Secret(api=mock.MagicMock(),
                                            payload=sample.X509_IMDS)
        self.private_key = secrets.Secret(
            api=mock.MagicMock(), payload=sample.X509_CERT_KEY_ENCRYPTED)
        self.private_key_passphrase = secrets.Secret(
            api=mock.MagicMock(), payload=sample.X509_CERT_KEY_PASSPHRASE)

        container = mock.Mock(spec=containers.CertificateContainer)
        container.container_ref = self.container_ref
        container.name = self.name
        container.private_key = self.private_key
        container.certificate = self.certificate
        container.intermediates = self.intermediates
        container.private_key_passphrase = self.private_key_passphrase
        self.container = container

        self.empty_container = mock.Mock(spec=containers.CertificateContainer)

        self.secret1 = mock.Mock(spec=secrets.Secret)
        self.secret2 = mock.Mock(spec=secrets.Secret)
        self.secret3 = mock.Mock(spec=secrets.Secret)
        self.secret4 = mock.Mock(spec=secrets.Secret)

        # Mock out the client
        self.bc = mock.Mock()
        barbican_auth = mock.Mock(spec=barbican_common.BarbicanAuth)
        barbican_auth.get_barbican_client.return_value = self.bc

        self.cert_manager = barbican_cert_mgr.BarbicanCertManager()
        self.cert_manager.auth = barbican_auth

        super(TestBarbicanManager, self).setUp()
예제 #3
0
 def test_load_auth_driver(self):
     bcm = barbican_cert_mgr.BarbicanCertManager()
     self.assertIsInstance(bcm.auth, barbican_acl.BarbicanACLAuth)