wip: support for app_name in URLPatternsTestCase

This commit is contained in:
Chris Shucksmith 2018-02-25 18:56:21 +00:00
parent 66307c5cfd
commit 1d161687a2

View File

@ -385,9 +385,14 @@ class URLPatternsTestCase(testcases.SimpleTestCase):
if hasattr(cls._module, 'urlpatterns'):
cls._module_urlpatterns = cls._module.urlpatterns
if hasattr(cls._module, 'app_name'):
cls._module_app_name = cls._module.app_name
cls._module.urlpatterns = cls.urlpatterns
if hasattr(cls, 'app_name'):
cls._module.app_name = cls.app_name
cls._override.enable()
super(URLPatternsTestCase, cls).setUpClass()
@ -400,3 +405,9 @@ class URLPatternsTestCase(testcases.SimpleTestCase):
cls._module.urlpatterns = cls._module_urlpatterns
else:
del cls._module.urlpatterns
if hasattr(cls, '_module_app_name'):
cls._module.app_name = cls._module_app_name
else:
if hasattr(cls._module, 'app_name'):
del cls._module.app_name