Merge remote-tracking branch 'origin/master' into hotfix
Signed-off-by: Roberto Rosario <roberto.rosario.gonzalez@gmail.com>
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import glob
|
||||
import importlib
|
||||
import os
|
||||
import random
|
||||
|
||||
@@ -255,15 +256,15 @@ class TestViewTestCaseMixin(object):
|
||||
has_test_view = False
|
||||
|
||||
def tearDown(self):
|
||||
from mayan.urls import urlpatterns
|
||||
urlconf = importlib.import_module(settings.ROOT_URLCONF)
|
||||
|
||||
self.client.logout()
|
||||
if self.has_test_view:
|
||||
urlpatterns.pop(0)
|
||||
urlconf.urlpatterns.pop(0)
|
||||
super(TestViewTestCaseMixin, self).tearDown()
|
||||
|
||||
def add_test_view(self, test_object):
|
||||
from mayan.urls import urlpatterns
|
||||
urlconf = importlib.import_module(settings.ROOT_URLCONF)
|
||||
|
||||
def test_view(request):
|
||||
template = Template('{{ object }}')
|
||||
@@ -272,7 +273,7 @@ class TestViewTestCaseMixin(object):
|
||||
)
|
||||
return HttpResponse(template.render(context=context))
|
||||
|
||||
urlpatterns.insert(0, url(TEST_VIEW_URL, test_view, name=TEST_VIEW_NAME))
|
||||
urlconf.urlpatterns.insert(0, url(TEST_VIEW_URL, test_view, name=TEST_VIEW_NAME))
|
||||
clear_url_caches()
|
||||
self.has_test_view = True
|
||||
|
||||
|
||||
Reference in New Issue
Block a user