1
0
mirror of https://github.com/django/django.git synced 2024-12-23 01:25:58 +00:00

Moved URLObject in tests to separate utils module.

This commit is contained in:
Marten Kenbeek 2015-12-22 22:10:52 +01:00
parent 394e59099c
commit 64ba7d8252
4 changed files with 28 additions and 22 deletions

View File

@ -1,6 +1,6 @@
from django.conf.urls import include, url
from .namespace_urls import URLObject
from .utils import URLObject
from .views import empty_view, view_class_instance
testobj3 = URLObject('testapp', 'test-ns3')

View File

@ -1,7 +1,7 @@
from django.conf.urls import include, url
from . import views
from .tests import URLObject
from .utils import URLObject
testobj1 = URLObject('testapp', 'test-ns1')
testobj2 = URLObject('testapp', 'test-ns2')

View File

@ -29,6 +29,7 @@ from django.utils import six
from django.utils.deprecation import RemovedInDjango20Warning
from . import middleware, urlconf_outer, views
from .utils import URLObject
from .views import empty_view
resolve_test_data = (
@ -242,26 +243,6 @@ test_data = (
)
class URLObject(object):
urlpatterns = [
url(r'^inner/$', views.empty_view, name='urlobject-view'),
url(r'^inner/(?P<arg1>[0-9]+)/(?P<arg2>[0-9]+)/$', views.empty_view, name='urlobject-view'),
url(r'^inner/\+\\\$\*/$', views.empty_view, name='urlobject-special-view'),
]
def __init__(self, app_name, namespace=None):
self.app_name = app_name
self.namespace = namespace
@property
def urls(self):
return self.urlpatterns, self.app_name, self.namespace
@property
def app_urls(self):
return self.urlpatterns, self.app_name
@override_settings(ROOT_URLCONF='urlpatterns_reverse.no_urls')
class NoURLPatternsTests(SimpleTestCase):

View File

@ -0,0 +1,25 @@
from __future__ import unicode_literals
from django.conf.urls import url
from . import views
class URLObject(object):
urlpatterns = [
url(r'^inner/$', views.empty_view, name='urlobject-view'),
url(r'^inner/(?P<arg1>[0-9]+)/(?P<arg2>[0-9]+)/$', views.empty_view, name='urlobject-view'),
url(r'^inner/\+\\\$\*/$', views.empty_view, name='urlobject-special-view'),
]
def __init__(self, app_name, namespace=None):
self.app_name = app_name
self.namespace = namespace
@property
def urls(self):
return self.urlpatterns, self.app_name, self.namespace
@property
def app_urls(self):
return self.urlpatterns, self.app_name