summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2017-07-18 15:06:39 +0000
committerGerrit Code Review <review@openstack.org>2017-07-18 15:06:39 +0000
commitfb76589a26288a7d7966cee1702e414919706790 (patch)
tree402405d627a6b84134f03fd4833fbd92ab99a091
parent33524c8d2c5ba28303c86e94b697db7847d726b5 (diff)
parent601e1ad44c18b9665c2ec6886438299de72d3761 (diff)
downloaddjango_openstack_auth-fb76589a26288a7d7966cee1702e414919706790.tar.gz
Merge "Fix Django 1.11 Compatibility"3.4.0
-rw-r--r--openstack_auth/tests/settings.py2
-rw-r--r--openstack_auth/tests/tests.py6
-rw-r--r--openstack_auth/utils.py5
3 files changed, 10 insertions, 3 deletions
diff --git a/openstack_auth/tests/settings.py b/openstack_auth/tests/settings.py
index 9590d51..1e750a2 100644
--- a/openstack_auth/tests/settings.py
+++ b/openstack_auth/tests/settings.py
@@ -13,6 +13,8 @@
import os
+ALLOWED_HOSTS = ['*']
+
DATABASES = {'default': {'ENGINE': 'django.db.backends.sqlite3'}}
INSTALLED_APPS = [
diff --git a/openstack_auth/tests/tests.py b/openstack_auth/tests/tests.py
index 80e5a88..0678b59 100644
--- a/openstack_auth/tests/tests.py
+++ b/openstack_auth/tests/tests.py
@@ -1099,7 +1099,8 @@ class OpenStackAuthTestsV3(OpenStackAuthTestsMixin,
url = reverse('login')
response = self.client.get(url)
self.assertEqual(response.status_code, 200)
- self.assertContains(response, 'name="domain" type="text"')
+ self.assertContains(response, 'id="id_domain"')
+ self.assertContains(response, 'name="domain"')
def test_login_form_multidomain_dropdown(self):
override = self.settings(OPENSTACK_KEYSTONE_MULTIDOMAIN_SUPPORT=True,
@@ -1113,7 +1114,8 @@ class OpenStackAuthTestsV3(OpenStackAuthTestsMixin,
url = reverse('login')
response = self.client.get(url)
self.assertEqual(response.status_code, 200)
- self.assertContains(response, 'select id="id_domain" name="domain"')
+ self.assertContains(response, 'id="id_domain"')
+ self.assertContains(response, 'name="domain"')
self.assertContains(response, 'option value="Default"')
settings.OPENSTACK_KEYSTONE_DOMAIN_DROPDOWN = False
diff --git a/openstack_auth/utils.py b/openstack_auth/utils.py
index 3d49b7a..d38d513 100644
--- a/openstack_auth/utils.py
+++ b/openstack_auth/utils.py
@@ -17,7 +17,6 @@ import re
from django.conf import settings
from django.contrib import auth
-from django.contrib.auth import middleware
from django.contrib.auth import models
from django.utils import timezone
from keystoneauth1.identity import v2 as v2_auth
@@ -62,6 +61,10 @@ def get_user(request):
def patch_middleware_get_user():
+ # NOTE(adriant): We can't import middleware until our customer user model
+ # is actually registered, otherwise a call to get_user_model within the
+ # middleware module will fail.
+ from django.contrib.auth import middleware
middleware.get_user = middleware_get_user
auth.get_user = get_user