Files
zaqar/marconi/tests/functional/base.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

44 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.
from marconi import tests as testing
# 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 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')