Files
zaqar/marconi/tests/functional/base.py
Flaper Fesp 31810473cf Remove util packages
This patch moves modules under util/ packages out to the parent level.

blueprint refactor-system-tests

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

39 lines
1.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.
import testtools
class FunctionalTestBase(testtools.TestCase):
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')