Files
deb-python-oslo.messaging/tests/test_urls.py
Mark McLoughlin 9cc66e1e01 Kill ability to specify exchange in transport URL
My original thinking was that if you're using the exchange name to
separate two instances of the applications (so their queues don't
collide) then the exchange name is pretty key to transport
configuration. In fact, it's really a virtual host that you'd use for
this (at least in the case of rabbit and qpid).

Also, Nova's cells code has already moved ahead with the assumption that
the path specifies a virtual host, so it'd only make sense to deviate
from that if there was a really good reason to.

Change-Id: Ic8b5dc3538b6b17afec524047acc2efa76366377
2013-08-12 06:09:48 +01:00

116 lines
4.3 KiB
Python

# Copyright 2013 Red Hat, 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 testscenarios
from oslo.messaging import _urls as urls
from tests import utils as test_utils
load_tests = testscenarios.load_tests_apply_scenarios
class TestParseURL(test_utils.BaseTestCase):
scenarios = [
('transport',
dict(url='foo:',
expect=dict(transport='foo',
virtual_host=None,
hosts=[],
parameters={}))),
('virtual_host_slash',
dict(url='foo:////',
expect=dict(transport='foo',
virtual_host='/',
hosts=[],
parameters={}))),
('virtual_host',
dict(url='foo:///bar',
expect=dict(transport='foo',
virtual_host='bar',
hosts=[],
parameters={}))),
('host',
dict(url='foo://host/bar',
expect=dict(transport='foo',
virtual_host='bar',
hosts=[
dict(host='host',
username='',
password=''),
],
parameters={}))),
('port',
dict(url='foo://host:1234/bar',
expect=dict(transport='foo',
virtual_host='bar',
hosts=[
dict(host='host:1234',
username='',
password=''),
],
parameters={}))),
('username',
dict(url='foo://u@host:1234/bar',
expect=dict(transport='foo',
virtual_host='bar',
hosts=[
dict(host='host:1234',
username='u',
password=''),
],
parameters={}))),
('password',
dict(url='foo://u:p@host:1234/bar',
expect=dict(transport='foo',
virtual_host='bar',
hosts=[
dict(host='host:1234',
username='u',
password='p'),
],
parameters={}))),
('multi_host',
dict(url='foo://u:p@host1:1234,host2:4321/bar',
expect=dict(transport='foo',
virtual_host='bar',
hosts=[
dict(host='host1:1234',
username='u',
password='p'),
dict(host='host2:4321',
username='u',
password='p'),
],
parameters={}))),
('multi_creds',
dict(url='foo://u1:p1@host1:1234,u2:p2@host2:4321/bar',
expect=dict(transport='foo',
virtual_host='bar',
hosts=[
dict(host='host1:1234',
username='u1',
password='p1'),
dict(host='host2:4321',
username='u2',
password='p2'),
],
parameters={}))),
]
def test_parse_url(self):
self.assertEqual(urls.parse_url(self.url), self.expect)