Files
zaqar/marconi/tests/functional/util/config.py
Malini Kamalambal eedbc417ea Refactor System Tests
This patch,
1. Renames 'System Tests' to 'Functional Tests'.
2. Reduces LOC by using ddt.
3. Removes test dependencies & the numbering convention used earlier.
4. Re-organizes the test suite structure.

blueprint refactor-system-tests

Change-Id: Ife236abf867b678beb72ea3a26a06d895ed8ad4b
2013-08-29 14:08:04 -04:00

103 lines
2.9 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 ConfigParser
import os
import uuid
class Config(object):
def __init__(self, config_path=None):
if config_path is None:
if os.path.exists('/etc/marconi/functional-tests.conf'):
config_path = '/etc/marconi/functional-tests.conf'
else:
config_path = os.path.expanduser('~/.marconi'
'/functional-tests.conf')
self.parser = ConfigParser.SafeConfigParser()
self.parser.read(config_path)
@property
def auth_enabled(self):
return self.parser.getboolean('auth', 'auth_on')
@property
def username(self):
return self.parser.get('auth', 'username')
@property
def password(self):
return self.parser.get('auth', 'password')
@property
def auth_url(self):
return self.parser.get('auth', 'url')
@property
def base_server(self):
return self.parser.get('marconi_env', 'marconi_url')
@property
def marconi_version(self):
return self.parser.get('marconi_env', 'marconi_version')
@property
def base_url(self):
return (self.base_server + '/' + self.marconi_version)
@property
def uuid(self):
return str(uuid.uuid1())
@property
def user_agent(self):
return self.parser.get('header_values', 'useragent')
@property
def host(self):
return self.parser.get('header_values', 'host')
@property
def project_id(self):
return self.parser.get('header_values', 'project_id')
@property
def queue_paging_uplimit(self):
return int(self.parser.get('marconi_config', 'queue_paging_uplimit'))
@property
def message_paging_uplimit(self):
return int(self.parser.get('marconi_config', 'message_paging_uplimit'))
@property
def message_ttl_max(self):
return int(self.parser.get('marconi_config', 'message_ttl_max'))
@property
def claim_ttl_max(self):
return int(self.parser.get('marconi_config', 'claim_ttl_max'))
@property
def claim_grace_max(self):
return int(self.parser.get('marconi_config', 'claim_grace_max'))
@property
def metadata_size_uplimit(self):
return self.parser.get('marconi_config', 'metadata_size_uplimit')
@property
def message_size_uplimit(self):
return self.parser.get('marconi_config', 'message_size_uplimit')