# Path: castellan/common/exception.py
# _FATAL_EXCEPTION_FORMAT_ERRORS = False
# class RedirectException(Exception):
# class CastellanException(Exception):
# class Forbidden(CastellanException):
# class KeyManagerError(CastellanException):
# class ManagedObjectNotFoundError(CastellanException):
# class InvalidManagedObjectDictError(CastellanException):
# class UnknownManagedObjectTypeError(CastellanException):
# class AuthTypeInvalidError(CastellanException):
# class InsufficientCredentialDataError(CastellanException):
#     def __init__(self, url):
#     def __init__(self, message_arg=None, *args, **kwargs):
# 
# Path: castellan/key_manager/vault_key_manager.py
# _DEFAULT_VAULT_URL = "http://127.0.0.1:8200"
# _DEFAULT_MOUNTPOINT = "secret"
# _DEFAULT_VERSION = 2
# _VAULT_OPT_GROUP = 'vault'
# _EXCEPTIONS_BY_CODE = [
#     requests.codes['internal_server_error'],
#     requests.codes['service_unavailable'],
#     requests.codes['request_timeout'],
#     requests.codes['gateway_timeout'],
#     requests.codes['precondition_failed'],
# ]
# LOG = logging.getLogger(__name__)
# class VaultKeyManager(key_manager.KeyManager):
#     def __init__(self, configuration):
#     def _get_url(self):
#     def _get_resource_url(self, key_id=None):
#     def _approle_token_id(self):
#     def _set_namespace(self, headers):
#     def _build_auth_headers(self):
#     def _do_http_request(self, method, resource, json=None):
#     def create_key_pair(self, context, algorithm, length,
#                         expiration=None, name=None):
#     def _store_key_value(self, key_id, value):
#     def create_key(self, context, algorithm, length, name=None, **kwargs):
#     def store(self, context, key_value, **kwargs):
#     def get(self, context, key_id, metadata_only=False):
#     def delete(self, context, key_id):
#     def list(self, context, object_type=None, metadata_only=False):
#     def list_options_for_discovery(self):
# 
# Path: castellan/tests/functional/config.py
# TEST_CONF = None
#     TEST_CONF = cfg.ConfigOpts()
# def setup_config(config_file=''):
# def get_config():
# def list_opts():
# 
# Path: castellan/tests/functional/key_manager/test_key_manager.py
# def _get_test_symmetric_key():
# def _get_test_public_key():
# def _get_test_private_key():
# def _get_test_certificate():
# def _get_test_opaque_data():
# def _get_test_passphrase():
#     def _create_key_manager(self):
#     def setUp(self):
#     def _get_valid_object_uuid(self, managed_object):
#     def test_create_key(self):
#     def test_create_key_pair(self):
#     def test_delete(self, managed_object):
#     def test_get(self, managed_object):
#     def test_get_metadata(self, managed_object):
#     def test_store(self, managed_object):
#     def test_list(self, managed_object):
#     def test_list_metadata_only(self, managed_object):
#     def test_list_with_filter(self, object_1, object_2, query_dict):
# class KeyManagerTestCase(object):


import os
import uuid
import requests
from oslo_config import cfg
from oslo_utils import uuidutils
from oslotest import base
from testtools import testcase
from castellan.common import exception
from castellan.key_manager import vault_key_manager
from castellan.tests.functional import config
from castellan.tests.functional.key_manager import test_key_manager
#    Licensed under the Apache License, Version 2.0 (the "License"); you may
#    not use this file except in compliance with the License. You may obtain
#    a copy of the License at
#
#         http://www.apache.org/licenses/LICENSE-2.0
#
#    Unless required by applicable law or agreed to in writing, software
#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
#    License for the specific language governing permissions and limitations
#    under the License.

"""
Functional test cases for the Vault key manager.

Note: This requires local running instance of Vault.
"""



CONF = config.get_config()


class VaultKeyManagerTestCase(test_key_manager.KeyManagerTestCase,
                              base.BaseTestCase):
    def _create_key_manager(self):

# Path: castellan/common/exception.py
# _FATAL_EXCEPTION_FORMAT_ERRORS = False
# class RedirectException(Exception):
# class CastellanException(Exception):
# class Forbidden(CastellanException):
# class KeyManagerError(CastellanException):
# class ManagedObjectNotFoundError(CastellanException):
# class InvalidManagedObjectDictError(CastellanException):
# class UnknownManagedObjectTypeError(CastellanException):
# class AuthTypeInvalidError(CastellanException):
# class InsufficientCredentialDataError(CastellanException):
#     def __init__(self, url):
#     def __init__(self, message_arg=None, *args, **kwargs):
# 
# Path: castellan/key_manager/vault_key_manager.py
# _DEFAULT_VAULT_URL = "http://127.0.0.1:8200"
# _DEFAULT_MOUNTPOINT = "secret"
# _DEFAULT_VERSION = 2
# _VAULT_OPT_GROUP = 'vault'
# _EXCEPTIONS_BY_CODE = [
#     requests.codes['internal_server_error'],
#     requests.codes['service_unavailable'],
#     requests.codes['request_timeout'],
#     requests.codes['gateway_timeout'],
#     requests.codes['precondition_failed'],
# ]
# LOG = logging.getLogger(__name__)
# class VaultKeyManager(key_manager.KeyManager):
#     def __init__(self, configuration):
#     def _get_url(self):
#     def _get_resource_url(self, key_id=None):
#     def _approle_token_id(self):
#     def _set_namespace(self, headers):
#     def _build_auth_headers(self):
#     def _do_http_request(self, method, resource, json=None):
#     def create_key_pair(self, context, algorithm, length,
#                         expiration=None, name=None):
#     def _store_key_value(self, key_id, value):
#     def create_key(self, context, algorithm, length, name=None, **kwargs):
#     def store(self, context, key_value, **kwargs):
#     def get(self, context, key_id, metadata_only=False):
#     def delete(self, context, key_id):
#     def list(self, context, object_type=None, metadata_only=False):
#     def list_options_for_discovery(self):
# 
# Path: castellan/tests/functional/config.py
# TEST_CONF = None
#     TEST_CONF = cfg.ConfigOpts()
# def setup_config(config_file=''):
# def get_config():
# def list_opts():
# 
# Path: castellan/tests/functional/key_manager/test_key_manager.py
# def _get_test_symmetric_key():
# def _get_test_public_key():
# def _get_test_private_key():
# def _get_test_certificate():
# def _get_test_opaque_data():
# def _get_test_passphrase():
#     def _create_key_manager(self):
#     def setUp(self):
#     def _get_valid_object_uuid(self, managed_object):
#     def test_create_key(self):
#     def test_create_key_pair(self):
#     def test_delete(self, managed_object):
#     def test_get(self, managed_object):
#     def test_get_metadata(self, managed_object):
#     def test_store(self, managed_object):
#     def test_list(self, managed_object):
#     def test_list_metadata_only(self, managed_object):
#     def test_list_with_filter(self, object_1, object_2, query_dict):
# class KeyManagerTestCase(object):


# Path: castellan/tests/functional/key_manager/test_vault_key_manager.py
import os
import uuid
import requests
from oslo_config import cfg
from oslo_utils import uuidutils
from oslotest import base
from testtools import testcase
from castellan.common import exception
from castellan.key_manager import vault_key_manager
from castellan.tests.functional import config
from castellan.tests.functional.key_manager import test_key_manager

#    Licensed under the Apache License, Version 2.0 (the "License"); you may
#    not use this file except in compliance with the License. You may obtain
#    a copy of the License at
#
#         http://www.apache.org/licenses/LICENSE-2.0
#
#    Unless required by applicable law or agreed to in writing, software
#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
#    License for the specific language governing permissions and limitations
#    under the License.

"""
Functional test cases for the Vault key manager.

Note: This requires local running instance of Vault.
"""



CONF = config.get_config()


class VaultKeyManagerTestCase(test_key_manager.KeyManagerTestCase,
                              base.BaseTestCase):
    def _create_key_manager(self):

        key_mgr = vault_key_manager.VaultKeyManager(cfg.CONF)