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)
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 @@
13 13
14import os 14import os
15 15
16ALLOWED_HOSTS = ['*']
17
16DATABASES = {'default': {'ENGINE': 'django.db.backends.sqlite3'}} 18DATABASES = {'default': {'ENGINE': 'django.db.backends.sqlite3'}}
17 19
18INSTALLED_APPS = [ 20INSTALLED_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,
1099 url = reverse('login') 1099 url = reverse('login')
1100 response = self.client.get(url) 1100 response = self.client.get(url)
1101 self.assertEqual(response.status_code, 200) 1101 self.assertEqual(response.status_code, 200)
1102 self.assertContains(response, 'name="domain" type="text"') 1102 self.assertContains(response, 'id="id_domain"')
1103 self.assertContains(response, 'name="domain"')
1103 1104
1104 def test_login_form_multidomain_dropdown(self): 1105 def test_login_form_multidomain_dropdown(self):
1105 override = self.settings(OPENSTACK_KEYSTONE_MULTIDOMAIN_SUPPORT=True, 1106 override = self.settings(OPENSTACK_KEYSTONE_MULTIDOMAIN_SUPPORT=True,
@@ -1113,7 +1114,8 @@ class OpenStackAuthTestsV3(OpenStackAuthTestsMixin,
1113 url = reverse('login') 1114 url = reverse('login')
1114 response = self.client.get(url) 1115 response = self.client.get(url)
1115 self.assertEqual(response.status_code, 200) 1116 self.assertEqual(response.status_code, 200)
1116 self.assertContains(response, 'select id="id_domain" name="domain"') 1117 self.assertContains(response, 'id="id_domain"')
1118 self.assertContains(response, 'name="domain"')
1117 self.assertContains(response, 'option value="Default"') 1119 self.assertContains(response, 'option value="Default"')
1118 settings.OPENSTACK_KEYSTONE_DOMAIN_DROPDOWN = False 1120 settings.OPENSTACK_KEYSTONE_DOMAIN_DROPDOWN = False
1119 1121
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
17 17
18from django.conf import settings 18from django.conf import settings
19from django.contrib import auth 19from django.contrib import auth
20from django.contrib.auth import middleware
21from django.contrib.auth import models 20from django.contrib.auth import models
22from django.utils import timezone 21from django.utils import timezone
23from keystoneauth1.identity import v2 as v2_auth 22from keystoneauth1.identity import v2 as v2_auth
@@ -62,6 +61,10 @@ def get_user(request):
62 61
63 62
64def patch_middleware_get_user(): 63def patch_middleware_get_user():
64 # NOTE(adriant): We can't import middleware until our customer user model
65 # is actually registered, otherwise a call to get_user_model within the
66 # middleware module will fail.
67 from django.contrib.auth import middleware
65 middleware.get_user = middleware_get_user 68 middleware.get_user = middleware_get_user
66 auth.get_user = get_user 69 auth.get_user = get_user
67 70