from django.conf.urls import url, include
from django.conf import settings
from django.contrib import admin
from django.views.generic import TemplateView

TEST_TEMPLATE = getattr(settings, 'TEST_TEMPLATE', 'test.html')

urlpatterns = [
    url('^accounts/', include('django.contrib.auth.urls')),
    url(r'^admin/', admin.site.urls),
    url(r'^$', TemplateView.as_view(template_name=TEST_TEMPLATE)),
]

from django.conf.urls import url, include
from django.conf import settings
from django.contrib import admin
from django.views.generic import TemplateView

urlpatterns = [
    url('^accounts/', include('django.contrib.auth.urls')),
    url(r'^admin/', admin.site.urls),
]

TEST_TEMPLATES = getattr(
    settings, 'TEST_TEMPLATES', [(r'^$', 'test.html')])

for path, template in TEST_TEMPLATES:
    urlpatterns.append(url(path, TemplateView.as_view(template_name=template)))

Support multiple templates in TEST_TEMPLATES setting.
Support multiple templates in TEST_TEMPLATES setting.

Unit tests need to be able to test redirects and other features
involving multiple web pages.  This commit changes the singleton
TEST_TEMPLATE setting to TEST_TEMPLATES, which is a list of
path, template tuples.

  from django.conf.urls import url, include
  from django.conf import settings
  from django.contrib import admin
  from django.views.generic import TemplateView
  
- TEST_TEMPLATE = getattr(settings, 'TEST_TEMPLATE', 'test.html')
- 
  urlpatterns = [
      url('^accounts/', include('django.contrib.auth.urls')),
      url(r'^admin/', admin.site.urls),
-     url(r'^$', TemplateView.as_view(template_name=TEST_TEMPLATE)),
  ]
  
+ TEST_TEMPLATES = getattr(
+     settings, 'TEST_TEMPLATES', [(r'^$', 'test.html')])
+ 
+ for path, template in TEST_TEMPLATES:
+     urlpatterns.append(url(path, TemplateView.as_view(template_name=template)))
+ 
Support multiple templates in TEST_TEMPLATES setting.
## Code Before:
from django.conf.urls import url, include
from django.conf import settings
from django.contrib import admin
from django.views.generic import TemplateView

TEST_TEMPLATE = getattr(settings, 'TEST_TEMPLATE', 'test.html')

urlpatterns = [
    url('^accounts/', include('django.contrib.auth.urls')),
    url(r'^admin/', admin.site.urls),
    url(r'^$', TemplateView.as_view(template_name=TEST_TEMPLATE)),
]

## Instruction:
Support multiple templates in TEST_TEMPLATES setting.
## Code After:
from django.conf.urls import url, include
from django.conf import settings
from django.contrib import admin
from django.views.generic import TemplateView

urlpatterns = [
    url('^accounts/', include('django.contrib.auth.urls')),
    url(r'^admin/', admin.site.urls),
]

TEST_TEMPLATES = getattr(
    settings, 'TEST_TEMPLATES', [(r'^$', 'test.html')])

for path, template in TEST_TEMPLATES:
    urlpatterns.append(url(path, TemplateView.as_view(template_name=template)))
