Moved URLObject in tests to separate utils module.
This commit is contained in:
parent
394e59099c
commit
64ba7d8252
|
@ -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')
|
||||
|
|
|
@ -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')
|
||||
|
|
|
@ -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):
|
||||
|
||||
|
|
|
@ -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
|
Loading…
Reference in New Issue