add more merge cases
This commit is contained in:
parent
f7a3bdc6db
commit
b21b4d1608
2 changed files with 8 additions and 3 deletions
|
|
@ -10,6 +10,7 @@
|
||||||
:license: BSD, see LICENSE for more details.
|
:license: BSD, see LICENSE for more details.
|
||||||
"""
|
"""
|
||||||
from functools import update_wrapper
|
from functools import update_wrapper
|
||||||
|
from werkzeug.urls import url_join
|
||||||
|
|
||||||
from .helpers import _PackageBoundObject, _endpoint_from_view_func
|
from .helpers import _PackageBoundObject, _endpoint_from_view_func
|
||||||
|
|
||||||
|
|
@ -49,8 +50,6 @@ class BlueprintSetupState(object):
|
||||||
url_prefix = self.options.get('url_prefix')
|
url_prefix = self.options.get('url_prefix')
|
||||||
if url_prefix is None:
|
if url_prefix is None:
|
||||||
url_prefix = self.blueprint.url_prefix
|
url_prefix = self.blueprint.url_prefix
|
||||||
if url_prefix:
|
|
||||||
url_prefix = url_prefix.rstrip('/')
|
|
||||||
#: The prefix that should be used for all URLs defined on the
|
#: The prefix that should be used for all URLs defined on the
|
||||||
#: blueprint.
|
#: blueprint.
|
||||||
self.url_prefix = url_prefix
|
self.url_prefix = url_prefix
|
||||||
|
|
@ -67,7 +66,8 @@ class BlueprintSetupState(object):
|
||||||
"""
|
"""
|
||||||
if self.url_prefix is not None:
|
if self.url_prefix is not None:
|
||||||
if rule:
|
if rule:
|
||||||
rule = '/'.join((self.url_prefix, rule.lstrip('/')))
|
rule = '/'.join((
|
||||||
|
self.url_prefix.rstrip('/'), rule.lstrip('/')))
|
||||||
else:
|
else:
|
||||||
rule = self.url_prefix
|
rule = self.url_prefix
|
||||||
options.setdefault('subdomain', self.subdomain)
|
options.setdefault('subdomain', self.subdomain)
|
||||||
|
|
|
||||||
|
|
@ -116,7 +116,12 @@ def test_blueprint_app_error_handling(app, client):
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize(('prefix', 'rule', 'url'), (
|
@pytest.mark.parametrize(('prefix', 'rule', 'url'), (
|
||||||
|
('', '/', '/'),
|
||||||
|
('/', '', '/'),
|
||||||
|
('/', '/', '/'),
|
||||||
('/foo', '', '/foo'),
|
('/foo', '', '/foo'),
|
||||||
|
('/foo/', '', '/foo/'),
|
||||||
|
('', '/bar', '/bar'),
|
||||||
('/foo/', '/bar', '/foo/bar'),
|
('/foo/', '/bar', '/foo/bar'),
|
||||||
('/foo/', 'bar', '/foo/bar'),
|
('/foo/', 'bar', '/foo/bar'),
|
||||||
('/foo', '/bar', '/foo/bar'),
|
('/foo', '/bar', '/foo/bar'),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue