
This patch allows to run functional tests under tox, however, they are disabled by default. In order to run tests with tox, it is necessary to enable them by modifying the functional-tests.conf and setting run_tests to True. This patch also merged both test files in a single one (test-requirements.txt) blueprint refactor-system-tests Change-Id: Iba440b12653cf9ee1454022830107a06b8a7bea9
65 lines
2.4 KiB
Python
65 lines
2.4 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.
|
|
|
|
from marconi import tests as testing
|
|
from marconi.tests.functional import config
|
|
from marconi.tests.functional import helpers
|
|
# NOTE(flaper87): This is necessary to register,
|
|
# wsgi configs and won't be permanent. It'll be
|
|
# refactored as part of the work for this blueprint
|
|
from marconi.transport import wsgi # noqa
|
|
|
|
|
|
class FunctionalTestBase(testing.TestBase):
|
|
|
|
def setUp(self):
|
|
super(FunctionalTestBase, self).setUp()
|
|
|
|
# NOTE(flaper87): Config can't be a class
|
|
# attribute because it may be necessary to
|
|
# modify it at runtime which will affect
|
|
# other instances running instances.
|
|
self.cfg = config.load_config()
|
|
|
|
if not self.cfg.run_tests:
|
|
self.skipTest("Functional tests disabled")
|
|
|
|
self.mconf = self.load_conf(self.cfg.marconi.config).conf
|
|
self.limits = self.mconf['limits:transport']
|
|
|
|
self.header = helpers.create_marconi_headers(self.cfg)
|
|
self.headers_response_with_body = set(['location',
|
|
'content-type'])
|
|
|
|
def assertIsSubset(self, required_values, actual_values):
|
|
"""Checks if a list is subset of another.
|
|
|
|
:param required_values: superset list.
|
|
:param required_values: subset list.
|
|
"""
|
|
|
|
form = 'Missing Header(s) - {}'
|
|
self.assertTrue(required_values.issubset(actual_values),
|
|
msg=form.format((required_values - actual_values)))
|
|
|
|
def assertMessageCount(self, expectedCount, actualCount):
|
|
"""Checks if number of messages returned <= limit
|
|
|
|
:param expectedCount: limit value passed in the url (OR) default(10).
|
|
:param actualCount: number of messages returned in the API response.
|
|
"""
|
|
self.assertTrue(actualCount <= expectedCount,
|
|
msg='More Messages returned than allowed')
|