Merge remote-tracking branch 'origin/master' into hotfix

Signed-off-by: Roberto Rosario <roberto.rosario.gonzalez@gmail.com>
This commit is contained in:
Roberto Rosario
2019-04-02 15:23:24 -04:00
3 changed files with 8 additions and 4 deletions

View File

@@ -12,6 +12,8 @@
* Apply merge !35 by Manoel Brunnen (@mbru) to fix building the Docker image * Apply merge !35 by Manoel Brunnen (@mbru) to fix building the Docker image
on the armv7l platform (RasperryPi, Odroid XU4, Odroid HC2). Also fixes on the armv7l platform (RasperryPi, Odroid XU4, Odroid HC2). Also fixes
assertion errors from pip (https://github.com/pypa/pip/issues/6197). assertion errors from pip (https://github.com/pypa/pip/issues/6197).
* Apply merge !37 by Roger Hunwicks (@roger.hunwicks) to allow
TestViewTestCaseMixin to work with a custom ROOT_URLCONF. GitLab issue #566.
3.1.9 (2018-11-01) 3.1.9 (2018-11-01)
================== ==================

View File

@@ -1,4 +1,5 @@
from __future__ import absolute_import, unicode_literals from __future__ import absolute_import, unicode_literals
import importlib
from django.test import TestCase from django.test import TestCase

View File

@@ -1,6 +1,7 @@
from __future__ import unicode_literals from __future__ import unicode_literals
import glob import glob
import importlib
import os import os
import random import random
@@ -255,15 +256,15 @@ class TestViewTestCaseMixin(object):
has_test_view = False has_test_view = False
def tearDown(self): def tearDown(self):
from mayan.urls import urlpatterns urlconf = importlib.import_module(settings.ROOT_URLCONF)
self.client.logout() self.client.logout()
if self.has_test_view: if self.has_test_view:
urlpatterns.pop(0) urlconf.urlpatterns.pop(0)
super(TestViewTestCaseMixin, self).tearDown() super(TestViewTestCaseMixin, self).tearDown()
def add_test_view(self, test_object): def add_test_view(self, test_object):
from mayan.urls import urlpatterns urlconf = importlib.import_module(settings.ROOT_URLCONF)
def test_view(request): def test_view(request):
template = Template('{{ object }}') template = Template('{{ object }}')
@@ -272,7 +273,7 @@ class TestViewTestCaseMixin(object):
) )
return HttpResponse(template.render(context=context)) 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() clear_url_caches()
self.has_test_view = True self.has_test_view = True