Files
zaqar/marconi/tests/functional/config.py
Flaper Fesp 90c3cb5bfa Use oslo.config for functional tests
Instead of defining a Config class for functional tests, this patch
integrates it with Marconi's base test suite and replaces the use of
ConfigParser with olso.config.

The patch doesn't change current behavior and gives the possibility to
use external configuration files for both the functional test and
Marconi.

blueprint refactor-system-tests

Change-Id: I60de6e199182881e945a24525c7c4f2d6937256f
2013-09-06 10:56:42 +02:00

52 lines
1.6 KiB
Python

# Copyright (c) 2013 Rackspace, Inc.
#
# 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.
import os
from oslo.config import cfg
_AUTH_OPTIONS = [
cfg.BoolOpt("auth_on", default=False),
cfg.StrOpt("url", default="https://127.0.0.1:5000/v2.0/tokens"),
cfg.StrOpt("username", default=None),
cfg.StrOpt("password", default=None),
]
_MARCONI_OPTIONS = [
cfg.StrOpt("url", default="http://127.0.0.1:8888"),
cfg.StrOpt("version", default="v1"),
cfg.StrOpt("config", default="functional-marconi.conf"),
]
_HEADERS_OPTIONS = [
cfg.StrOpt("host", default="example.com"),
cfg.StrOpt("user_agent", default="FunctionalTests"),
cfg.StrOpt("project_id", default="123456"),
]
def load_config():
conf = cfg.ConfigOpts()
conf.register_opts(_AUTH_OPTIONS, group="auth")
conf.register_opts(_MARCONI_OPTIONS, group="marconi")
conf.register_opts(_HEADERS_OPTIONS, group="headers")
conf_path = os.path.join(os.environ["MARCONI_TESTS_CONFIGS_DIR"],
"functional-tests.conf")
conf(args=[], default_config_files=[conf_path])
return conf