Update hacking version and fix new violations

The newer hacking version is more strict about some things, so I
had to update a bunch of files with minor issues that previously
fell through the cracks.

Change-Id: I169bc6f8533bab28c7d6cf321ea83a8d7945f136
This commit is contained in:
kgriffs 2014-06-17 19:09:48 -05:00
parent a6f60a2044
commit bf0645fdb5
31 changed files with 155 additions and 138 deletions

View File

@ -13,6 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import os
from oslo.config import cfg
from marconi.common import cli

View File

@ -22,6 +22,7 @@ import six
def fields(d, names, pred=lambda x: True,
key_transform=lambda x: x, value_transform=lambda x: x):
"""Returns the entries in this dictionary with keys appearing in names.
:type d: dict
:type names: [a]
:param pred: a filter that is applied to the values of the dictionary.
@ -32,8 +33,8 @@ def fields(d, names, pred=lambda x: True,
returning it
:type value_transform: a -> a
:rtype: dict
"""
return dict((key_transform(k), value_transform(v))
for k, v in six.iteritems(d)
if k in names and pred(v))
@ -58,7 +59,9 @@ def dict_to_conf(options):
:returns: a list of options compatible with oslo.config
:rtype: [oslo.config.cfg.Opt]
"""
opts = []
for k, v in six.iteritems(options):
opt_type = _pytype_to_cfgtype[type(v)]
opts.append(opt_type(name=k, default=v))

View File

@ -23,7 +23,6 @@ from marconi.openstack.common import log
from marconi.queues.storage import pipeline
from marconi.queues.storage import pooling
from marconi.queues.storage import utils as storage_utils
from marconi.queues import transport # NOQA
LOG = log.getLogger(__name__)

View File

@ -16,6 +16,7 @@
"""Implements the DriverBase abstract class for Marconi storage drivers."""
import abc
import six
DEFAULT_QUEUES_PER_PAGE = 10
@ -480,15 +481,15 @@ class PoolsBase(ControllerBase):
@six.add_metaclass(abc.ABCMeta)
class CatalogueBase(ControllerBase):
"""A controller for managing the catalogue. The catalogue is
responsible for maintaining a mapping between project.queue
entries to their pool.
"""A controller for managing the catalogue.
The catalogue is responsible for maintaining a mapping
between project.queue entries to their pool.
"""
@abc.abstractmethod
def list(self, project):
"""Returns a list of queue entries from the catalogue associated with
this project.
"""Get a list of queues from the catalogue.
:param project: The project to use when filtering through queue
entries.
@ -500,8 +501,7 @@ class CatalogueBase(ControllerBase):
@abc.abstractmethod
def get(self, project, queue):
"""Returns the pool identifier for the queue registered under this
project.
"""Returns the pool identifier for the given queue.
:param project: Namespace to search for the given queue
:type project: six.text_type
@ -527,7 +527,7 @@ class CatalogueBase(ControllerBase):
@abc.abstractmethod
def insert(self, project, queue, pool):
"""Creates a new catalogue entry, or updates it if it already existed.
"""Creates a new catalogue entry, or updates it if it already exists.
:param project: str - Namespace to insert the given queue into
:type project: six.text_type
@ -551,7 +551,7 @@ class CatalogueBase(ControllerBase):
@abc.abstractmethod
def update(self, project, queue, pools=None):
"""Updates the pool identifier for this queue
"""Updates the pool identifier for this queue.
:param project: Namespace to search
:type project: six.text_type

View File

@ -24,9 +24,7 @@ class ExceptionBase(Exception):
class ConnectionError(ExceptionBase):
"""Raised when the connection with the back-end
was lost.
"""
"""Raised when the connection with the back-end was lost."""
class DoesNotExist(ExceptionBase):
@ -38,9 +36,7 @@ class NotPermitted(ExceptionBase):
class Conflict(ExceptionBase):
"""Resource could not be created due to a conflict
with an existing resource.
"""
"""Resource could not be created due to a conflict."""
class MessageConflict(Conflict):
@ -51,13 +47,15 @@ class MessageConflict(Conflict):
def __init__(self, queue, project, message_ids):
"""Initializes the error with contextual information.
:param queue: name of the queue to which the message was posted
:param project: name of the project to which the queue belongs
:param message_ids: list of IDs for messages successfully
posted. Note that these must be in the same order as the
list of messages originally submitted to be enqueued.
posted. Note that these must be in the same order as the
list of messages originally submitted to be enqueued.
"""
super(MessageConflict, self).__init__(queue=queue, project=project)
self._succeeded_ids = message_ids

View File

@ -148,9 +148,9 @@ class MessageController(storage.Message):
for collection in self._collections:
self._ensure_indexes(collection)
#-----------------------------------------------------------------------
# ----------------------------------------------------------------------
# Helpers
#-----------------------------------------------------------------------
# ----------------------------------------------------------------------
def _ensure_indexes(self, collection):
"""Ensures that all indexes are created."""
@ -296,9 +296,9 @@ class MessageController(storage.Message):
# ensure the most performant one is chosen.
return cursor.hint(ACTIVE_INDEX_FIELDS)
#-----------------------------------------------------------------------
# ----------------------------------------------------------------------
# "Friends" interface
#-----------------------------------------------------------------------
# ----------------------------------------------------------------------
def _count(self, queue_name, project=None, include_claimed=False):
"""Return total number of messages in a queue.
@ -358,8 +358,7 @@ class MessageController(storage.Message):
collection = self._collection(queue_name, project)
msgs = collection.find(query, sort=[('k', 1)],
read_preference=preference).hint(
CLAIMED_INDEX_FIELDS
)
CLAIMED_INDEX_FIELDS)
if limit is not None:
msgs = msgs.limit(limit)
@ -392,9 +391,9 @@ class MessageController(storage.Message):
{'$set': {'c': {'id': None, 'e': now}}},
upsert=False, multi=True)
#-----------------------------------------------------------------------
# ----------------------------------------------------------------------
# Public interface
#-----------------------------------------------------------------------
# ----------------------------------------------------------------------
def list(self, queue_name, project=None, marker=None,
limit=storage.DEFAULT_MESSAGES_PER_PAGE,

View File

@ -94,9 +94,9 @@ class QueueController(storage.Queue):
# a specific project, for example. Order matters!
self._collection.ensure_index([('p_q', 1)], unique=True)
#-----------------------------------------------------------------------
# ----------------------------------------------------------------------
# Helpers
#-----------------------------------------------------------------------
# ----------------------------------------------------------------------
def _get(self, name, project=None, fields={'m': 1, '_id': 0}):
queue = self._collection.find_one(_get_scoped_query(name, project),
@ -190,9 +190,9 @@ class QueueController(storage.Queue):
return doc['c']['v']
#-----------------------------------------------------------------------
# ----------------------------------------------------------------------
# Interface
#-----------------------------------------------------------------------
# ----------------------------------------------------------------------
def list(self, project=None, marker=None,
limit=storage.DEFAULT_QUEUES_PER_PAGE, detailed=False):

View File

@ -122,6 +122,7 @@ def to_oid(obj):
def oid_ts(oid):
"""Converts an ObjectId to a UNIX timestamp.
:raises: TypeError if oid isn't an ObjectId
"""
try:

View File

@ -127,8 +127,7 @@ class RoutingController(storage.base.ControllerBase):
class QueueController(RoutingController):
"""Controller to facilitate special processing for queue operations.
"""
"""Controller to facilitate special processing for queue operations."""
_resource_name = 'queue'

View File

@ -35,10 +35,10 @@ class ClaimController(storage.Claim):
sa.and_(
tables.Messages.c.ttl >
utils.get_age(tables.Messages.c.created),
#tables.Messages.c.ttl >
#utils.get_age(tables.Claims.c.created),
tables.Messages.c.cid == cid
))
# tables.Messages.c.ttl >
# utils.get_age(tables.Claims.c.created),
tables.Messages.c.cid == cid))
records = trans.execute(sel)
for id, body, ttl, created in records:
@ -141,8 +141,9 @@ class ClaimController(storage.Claim):
update = tables.Claims.update().where(sa.and_(
tables.Claims.c.ttl > age,
tables.Claims.c.id == cid,
tables.Claims.c.id == qid)).\
values(ttl=metadata['ttl'])
tables.Claims.c.id == qid))
update = update.values(ttl=metadata['ttl'])
res = trans.execute(update)
if res.rowcount != 1:

View File

@ -215,11 +215,13 @@ class MessageController(storage.Message):
with self.driver.trans() as trans:
qid = utils.get_qid(self.driver, queue, project)
# TODO(kgriffs): Need to port this to sqla! Bug #1331228
#
# cleanup all expired messages in this queue
#self.driver.run('''
# delete from Messages
# where ttl <= julianday() * 86400.0 - created
# and qid = ?''', qid)
# self.driver.run('''
# delete from Messages
# where ttl <= julianday() * 86400.0 - created
# and qid = ?''', qid)
# executemany() sets lastrowid to None, so no matter we manually
# generate the IDs or not, we still need to query for it.

View File

@ -98,11 +98,12 @@ class QueueController(storage.Queue):
if project is None:
project = ''
update = tables.Queues.update().\
where(sa.and_(
tables.Queues.c.project == project,
tables.Queues.c.name == name)).\
values(metadata=utils.json_encode(metadata))
update = (tables.Queues.update().
where(sa.and_(
tables.Queues.c.project == project,
tables.Queues.c.name == name)).
values(metadata=utils.json_encode(metadata)))
res = self.driver.run(update)
try:
@ -131,15 +132,13 @@ class QueueController(storage.Queue):
tables.Messages.c.qid == qid,
tables.Messages.c.cid != (None),
tables.Messages.c.ttl >
sfunc.now() - tables.Messages.c.created,
)),
sfunc.now() - tables.Messages.c.created)),
sa.sql.select([sa.func.count(tables.Messages.c.id)],
sa.and_(
tables.Messages.c.qid == qid,
tables.Messages.c.cid == (None),
tables.Messages.c.ttl >
sfunc.now() - tables.Messages.c.created,
))
sfunc.now() - tables.Messages.c.created))
])
claimed, free = self.driver.get(sel)

View File

@ -14,9 +14,9 @@
# limitations under the License.
import abc
import six
from oslo.config import cfg
import six
_TRANSPORT_OPTIONS = (

View File

@ -18,9 +18,9 @@ import json
# NOTE(kgriffs): http://tools.ietf.org/html/draft-nottingham-json-home-03
JSON_HOME = {
'resources': {
#------------------------------------------------------------------
# -----------------------------------------------------------------
# Queues
#------------------------------------------------------------------
# -----------------------------------------------------------------
'rel/queues': {
'href-template': '/v1/queues{?marker,limit,detailed}',
'href-vars': {
@ -72,9 +72,9 @@ JSON_HOME = {
},
},
#------------------------------------------------------------------
# -----------------------------------------------------------------
# Messages
#------------------------------------------------------------------
# -----------------------------------------------------------------
'rel/messages': {
'href-template': ('/v1/queues/{queue_name}/messages'
'{?marker,limit,echo,include_claimed}'),
@ -106,9 +106,9 @@ JSON_HOME = {
},
},
#------------------------------------------------------------------
# -----------------------------------------------------------------
# Claims
#------------------------------------------------------------------
# -----------------------------------------------------------------
'rel/claim': {
'href-template': '/v1/queues/{queue_name}/claims{?limit}',
'href-vars': {

View File

@ -38,9 +38,9 @@ class CollectionResource(object):
self._validate = validate
self.message_controller = message_controller
#-----------------------------------------------------------------------
# ----------------------------------------------------------------------
# Helpers
#-----------------------------------------------------------------------
# ----------------------------------------------------------------------
def _get_by_id(self, base_path, project_id, queue_name, ids):
"""Returns one or more messages from the queue by ID."""
@ -127,9 +127,9 @@ class CollectionResource(object):
]
}
#-----------------------------------------------------------------------
# ----------------------------------------------------------------------
# Interface
#-----------------------------------------------------------------------
# ----------------------------------------------------------------------
def on_post(self, req, resp, project_id, queue_name):
LOG.debug(u'Messages collection POST - queue: %(queue)s, '

View File

@ -18,9 +18,9 @@ import json
# NOTE(kgriffs): http://tools.ietf.org/html/draft-nottingham-json-home-03
JSON_HOME = {
'resources': {
#------------------------------------------------------------------
# -----------------------------------------------------------------
# Queues
#------------------------------------------------------------------
# -----------------------------------------------------------------
'rel/queues': {
'href-template': '/v1.1/queues{?marker,limit,detailed}',
'href-vars': {
@ -72,9 +72,9 @@ JSON_HOME = {
},
},
#------------------------------------------------------------------
# -----------------------------------------------------------------
# Messages
#------------------------------------------------------------------
# -----------------------------------------------------------------
'rel/messages': {
'href-template': ('/v1.1/queues/{queue_name}/messages'
'{?marker,limit,echo,include_claimed}'),
@ -106,9 +106,9 @@ JSON_HOME = {
},
},
#------------------------------------------------------------------
# -----------------------------------------------------------------
# Claims
#------------------------------------------------------------------
# -----------------------------------------------------------------
'rel/claim': {
'href-template': '/v1.1/queues/{queue_name}/claims{?limit}',
'href-vars': {

View File

@ -41,9 +41,9 @@ class CollectionResource(object):
self.message_controller = message_controller
self.queue_controller = queue_controller
#-----------------------------------------------------------------------
# ----------------------------------------------------------------------
# Helpers
#-----------------------------------------------------------------------
# ----------------------------------------------------------------------
def _get_by_id(self, base_path, project_id, queue_name, ids):
"""Returns one or more messages from the queue by ID."""
@ -131,9 +131,9 @@ class CollectionResource(object):
]
}
#-----------------------------------------------------------------------
# ----------------------------------------------------------------------
# Interface
#-----------------------------------------------------------------------
# ----------------------------------------------------------------------
def on_post(self, req, resp, project_id, queue_name):
LOG.debug(u'Messages collection POST - queue: %(queue)s, '

View File

@ -15,9 +15,10 @@
# limitations under the License.
import abc
import jsonschema
import multiprocessing
import os
import jsonschema
import six
from marconi.openstack.common import timeutils
@ -113,8 +114,8 @@ class FunctionalTestBase(testing.TestBase):
:param expectedCount: limit value passed in the url (OR) default(10).
:param actualCount: number of messages returned in the API response.
"""
msg = 'More Messages returned than allowed: expected count = {0}' \
', actual count = {1}'.format(expectedCount, actualCount)
msg = ('More Messages returned than allowed: expected count = {0}'
', actual count = {1}'.format(expectedCount, actualCount))
self.assertTrue(actualCount <= expectedCount, msg)
def assertSchema(self, response, expectedSchemaName):
@ -188,8 +189,8 @@ class FunctionalTestBase(testing.TestBase):
# (needed to pass this test on sqlite driver)
delta = int(delta)
msg = 'Invalid Time Delta {0}, Created time {1}, Now {2}' \
.format(delta, created_time, now)
msg = ('Invalid Time Delta {0}, Created time {1}, Now {2}'
.format(delta, created_time, now))
self.assertTrue(0 <= delta <= 6000, msg)

View File

@ -58,8 +58,10 @@ def expect(*exc_type):
@contextlib.contextmanager
def partitions(controller, count):
"""context_manager: Creates `count` partitions in storage,
and deletes them once this goes out of scope.
"""Context manager to create several partitions for testing.
The partitions are automatically deleted when the context manager
goes out of scope.
:param controller:
:param count: int - number of partitions to create
@ -78,8 +80,10 @@ def partitions(controller, count):
@contextlib.contextmanager
def partition(controller, name, weight, hosts):
"""context_manager: Creates a single partition that is deleted
once this context manager goes out of scope.
"""Context manager to create a single partition for testing.
The partition is automatically deleted when the context manager
goes out of scope.
:param controller: storage handler
:param name: str - partition name
@ -94,8 +98,10 @@ def partition(controller, name, weight, hosts):
@contextlib.contextmanager
def entry(controller, project, queue, partition, host, metadata={}):
"""Creates a catalogue entry with the given details, and deletes
it once the context manager goes out of scope.
"""Context manager to create a catalogue entry for testing.
The entry is automatically deleted when the context manager
goes out of scope.
:param controller: storage handler
:param project: str - namespace for queue
@ -112,8 +118,10 @@ def entry(controller, project, queue, partition, host, metadata={}):
@contextlib.contextmanager
def entries(controller, count):
"""Creates `count` catalogue entries with the given details, and
deletes them once the context manager goes out of scope.
"""Context manager to create several catalogue entries for testing.
The entries are automatically deleted when the context manager
goes out of scope.
:param controller: storage handler
:param count: int - number of entries to create
@ -134,8 +142,10 @@ def entries(controller, count):
@contextlib.contextmanager
def pool_entry(controller, project, queue, pool):
"""Creates a catalogue entry with the given details, and deletes
it once the context manager goes out of scope.
"""Context manager to create a catalogue entry for testing.
The entry is automatically deleted when the context manager
goes out of scope.
:param controller: storage handler
:type controller: queues.storage.base:CatalogueBase
@ -155,8 +165,10 @@ def pool_entry(controller, project, queue, pool):
@contextlib.contextmanager
def pool_entries(controller, count):
"""Creates `count` catalogue entries with the given details, and
deletes them once the context manager goes out of scope.
"""Context manager to create several catalogue entries for testing.
The entries are automatically deleted when the context manager
goes out of scope.
:param controller: storage handler
:type controller: queues.storage.base:CatalogueBase

View File

@ -16,11 +16,10 @@ from falcon import testing as ftest
from marconi.openstack.common import jsonutils
from marconi.queues import bootstrap
from marconi.queues.transport import validation
from marconi.queues.transport.wsgi import driver
from marconi import tests as testing
from marconi.queues.transport import validation
class TestBase(testing.TestBase):
@ -111,6 +110,7 @@ class TestBaseFaulty(TestBase):
class V1Base(TestBase):
"""Base class for V1 API Tests.
Should contain methods specific to V1 of the API
"""
pass
@ -118,6 +118,7 @@ class V1Base(TestBase):
class V1BaseFaulty(TestBaseFaulty):
"""Base class for V1 API Faulty Tests.
Should contain methods specific to V1 exception testing
"""
pass
@ -125,6 +126,7 @@ class V1BaseFaulty(TestBaseFaulty):
class V1_1Base(TestBase):
"""Base class for V1.1 API Tests.
Should contain methods specific to V1.1 of the API
"""
@ -147,6 +149,7 @@ class V1_1Base(TestBase):
class V1_1BaseFaulty(TestBaseFaulty):
"""Base class for V1.1 API Faulty Tests.
Should contain methods specific to V1.1 exception testing
"""
pass

View File

@ -137,7 +137,7 @@ class ClaimsBaseTest(base.V1Base):
self.assertEqual(self.srmock.headers_dict['Content-Location'],
claim_href)
self.assertEqual(claim['ttl'], 100)
## NOTE(cpp-cabrera): verify that claim age is non-negative
# NOTE(cpp-cabrera): verify that claim age is non-negative
self.assertThat(claim['age'], matchers.GreaterThan(-1))
# Try to delete the message without submitting a claim_id

View File

@ -15,10 +15,7 @@
import falcon
import six.moves.urllib.parse as urlparse
from marconi.openstack.common import jsonutils
from marconi.tests.queues.transport.wsgi import base

View File

@ -234,8 +234,7 @@ class MessagesBaseTest(base.V1Base):
@ddt.data(-1, 59, 1209601)
def test_unacceptable_ttl(self, ttl):
self.simulate_post(self.queue_path + '/messages',
body=jsonutils.dumps([{'ttl': ttl,
'body': None}]),
body=jsonutils.dumps([{'ttl': ttl, 'body': None}]),
headers=self.headers)
self.assertEqual(self.srmock.status, falcon.HTTP_400)
@ -428,8 +427,8 @@ class MessagesBaseTest(base.V1Base):
self.assertEqual(self.srmock.status, falcon.HTTP_200)
def test_no_duplicated_messages_path_in_href(self):
"""Fixes bug 1240897
"""
"""Test for bug 1240897."""
path = self.queue_path + '/messages'
self._post_messages(path, repeat=1)

View File

@ -19,13 +19,13 @@ import uuid
import ddt
import falcon
from marconi.tests.queues.transport.wsgi import base
import mock
from testtools import matchers
from marconi.openstack.common import jsonutils
from marconi.openstack.common import timeutils
from marconi import tests as testing
from marconi.tests.queues.transport.wsgi import base
@ddt.ddt
@ -172,7 +172,7 @@ class ClaimsBaseTest(base.V1_1Base):
self.assertEqual(self.srmock.headers_dict['Content-Location'],
claim_href)
self.assertEqual(claim['ttl'], 100)
## NOTE(cpp-cabrera): verify that claim age is non-negative
# NOTE(cpp-cabrera): verify that claim age is non-negative
self.assertThat(claim['age'], matchers.GreaterThan(-1))
# Try to delete the message without submitting a claim_id

View File

@ -444,8 +444,8 @@ class MessagesBaseTest(base.V1_1Base):
self.assertEqual(self.srmock.status, falcon.HTTP_200)
def test_no_duplicated_messages_path_in_href(self):
"""Fixes bug 1240897
"""
"""Test for bug 1240897."""
path = self.queue_path + '/messages'
self._post_messages(path, repeat=1)

View File

@ -1,5 +1,5 @@
# Metrics and style
hacking>=0.8.0,<0.9
hacking>=0.9.2,<0.10
# Packaging
mock>=1.0

View File

@ -41,7 +41,7 @@ class TestClaims(base.FunctionalTestBase):
self.claim_url = self.queue_url + '/claims'
self.client.set_base_url(self.claim_url)
#Post Messages
# Post Messages
url = self.queue_url + '/messages'
doc = helpers.create_message_body(
messagecount=self.limits.max_messages_per_page)
@ -102,13 +102,13 @@ class TestClaims(base.FunctionalTestBase):
def test_claim_patch(self):
"""Update Claim."""
#Test Setup - Post Claim
# Test Setup - Post Claim
doc = {"ttl": 300, "grace": 400}
result = self.client.post(data=doc)
self.assertEqual(result.status_code, 201)
#Patch Claim
# Patch Claim
claim_location = result.headers['Location']
url = self.cfg.marconi.url + claim_location
doc_updated = {"ttl": 300}
@ -116,7 +116,7 @@ class TestClaims(base.FunctionalTestBase):
result = self.client.patch(url, data=doc_updated)
self.assertEqual(result.status_code, 204)
#verify that the claim TTL is updated
# verify that the claim TTL is updated
result = self.client.get(url)
new_ttl = result.json()['ttl']
self.assertEqual(new_ttl, 300)
@ -125,13 +125,13 @@ class TestClaims(base.FunctionalTestBase):
def test_delete_claimed_message(self):
"""Delete message belonging to a Claim."""
#Test Setup - Post claim
# Test Setup - Post claim
doc = {"ttl": 60, "grace": 60}
result = self.client.post(data=doc)
self.assertEqual(result.status_code, 201)
#Delete Claimed Messages
# Delete Claimed Messages
for rst in result.json():
href = rst['href']
url = self.cfg.marconi.url + href
@ -147,11 +147,11 @@ class TestClaims(base.FunctionalTestBase):
result = self.client.post(data=doc)
self.assertEqual(result.status_code, 201)
#Extract claim location and construct the claim URL.
# Extract claim location and construct the claim URL.
location = result.headers['Location']
url = self.cfg.marconi.url + location
#Release Claim.
# Release Claim.
result = self.client.delete(url)
self.assertEqual(result.status_code, 204)
@ -214,11 +214,11 @@ class TestClaims(base.FunctionalTestBase):
result = self.client.post(data=doc)
self.assertEqual(result.status_code, 201)
#Extract claim location and construct the claim URL.
# Extract claim location and construct the claim URL.
location = result.headers['Location']
url = self.cfg.marconi.url + location
#Patch Claim.
# Patch Claim.
doc = {"ttl": ttl}
result = self.client.patch(url, data=doc)
self.assertEqual(result.status_code, 400)

View File

@ -146,8 +146,9 @@ class TestMessages(base.FunctionalTestBase):
expected_msg_count = params.get('limit', 10)
# Test Setup
doc = helpers.create_message_body(messagecount=
self.limits.max_messages_per_page)
doc = helpers.create_message_body(
messagecount=self.limits.max_messages_per_page)
result = self.client.post(data=doc)
self.assertEqual(result.status_code, 201)
@ -300,9 +301,9 @@ class TestMessages(base.FunctionalTestBase):
By default, max messages that can be deleted in a single
request is 20.
"""
url = self.message_url + '?ids=' \
+ ','.join(str(i) for i in
range(self.limits.max_messages_per_page + 1))
url = (self.message_url + '?ids=' +
','.join(str(i) for i in
range(self.limits.max_messages_per_page + 1)))
result = self.client.delete(url)
self.assertEqual(result.status_code, 400)
@ -315,9 +316,9 @@ class TestMessages(base.FunctionalTestBase):
By default, max messages that can be fetched in a single
request is 20.
"""
url = self.message_url + '?ids=' \
+ ','.join(str(i) for i in
range(self.limits.max_messages_per_page + 1))
url = (self.message_url + '?ids=' +
','.join(str(i) for i in
range(self.limits.max_messages_per_page + 1)))
result = self.client.get(url)
self.assertEqual(result.status_code, 400)

View File

@ -264,9 +264,10 @@ class TestQueueMisc(base.FunctionalTestBase):
self.base_url = self.cfg.marconi.url
self.client.set_base_url(self.base_url)
self.queue_url = self.base_url + '/{0}/queues/{1}' \
.format(self.cfg.marconi.version,
uuid.uuid1())
template = self.base_url + '/{0}/queues/{1}'
self.queue_url = template.format(self.cfg.marconi.version,
uuid.uuid1())
def test_list_queues(self):
"""List Queues."""
@ -274,8 +275,9 @@ class TestQueueMisc(base.FunctionalTestBase):
self.client.put(self.queue_url)
self.addCleanup(self.client.delete, self.queue_url)
result = self.client.get('/{0}/queues'
.format(self.cfg.marconi.version))
url = '/{0}/queues'.format(self.cfg.marconi.version)
result = self.client.get(url)
self.assertEqual(result.status_code, 200)
self.assertSchema(result.json(), 'queue_list')
@ -418,8 +420,8 @@ class TestQueueNonExisting(base.FunctionalTestBase):
super(TestQueueNonExisting, self).setUp()
self.base_url = '{0}/{1}'.format(self.cfg.marconi.url,
self.cfg.marconi.version)
self.queue_url = self.base_url + \
'/queues/0a5b1b85-4263-11e3-b034-28cfe91478b9'
self.queue_url = (self.base_url +
'/queues/0a5b1b85-4263-11e3-b034-28cfe91478b9')
self.client.set_base_url(self.queue_url)
self.header = helpers.create_marconi_headers(self.cfg)

View File

@ -18,9 +18,9 @@ from marconi.tests.queues.transport.wsgi import base
from marconi.tests.queues.transport.wsgi import v1
#----------------------------------------------------------------------------
# --------------------------------------------------------------------------
# Identical or just minor variations across versions
#----------------------------------------------------------------------------
# --------------------------------------------------------------------------
URL_PREFIX = '/v1'
@ -89,9 +89,9 @@ class TestPoolsSqlalchemy(v1.TestPoolsSqlalchemy):
url_prefix = URL_PREFIX
#----------------------------------------------------------------------------
# --------------------------------------------------------------------------
# v1.0 only
#----------------------------------------------------------------------------
# --------------------------------------------------------------------------
class TestHealth(base.V1Base):

View File

@ -17,9 +17,9 @@ import falcon
from marconi.tests.queues.transport.wsgi import base
from marconi.tests.queues.transport.wsgi import v1_1
#----------------------------------------------------------------------------
# --------------------------------------------------------------------------
# Identical or just minor variations across versions
#----------------------------------------------------------------------------
# --------------------------------------------------------------------------
URL_PREFIX = '/v1.1'
@ -90,9 +90,9 @@ class TestPoolsSqlalchemy(v1_1.TestPoolsSqlalchemy):
url_prefix = URL_PREFIX
#----------------------------------------------------------------------------
# --------------------------------------------------------------------------
# v1.1 only
#----------------------------------------------------------------------------
# --------------------------------------------------------------------------
class TestPing(base.V1_1Base):