From 1d161687a2774b7a814456eda93e2babb7750a05 Mon Sep 17 00:00:00 2001 From: Chris Shucksmith Date: Sun, 25 Feb 2018 18:56:21 +0000 Subject: [PATCH] wip: support for app_name in URLPatternsTestCase --- rest_framework/test.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/rest_framework/test.py b/rest_framework/test.py index edacf0066..b78332b36 100644 --- a/rest_framework/test.py +++ b/rest_framework/test.py @@ -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