summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Cresswell <robert.cresswell@outlook.com>2017-07-18 12:06:58 +0100
committerRob Cresswell <robert.cresswell@outlook.com>2017-07-18 12:30:37 +0100
commit601e1ad44c18b9665c2ec6886438299de72d3761 (patch)
treee28cf3808345611068175f6ba140fbce86e92eed
parenta0af708a49518937eab3656e7a4302687508a2ce (diff)
Fix Django 1.11 Compatibility
Implements: blueprint dj111 Change-Id: Idfaef58b2a069006f6d792e43041dd136097c413 Co-Authored-By: Adrian Turjak <adriant@catalyst.net.nz>
Notes
Notes (review): Code-Review+2: Akihiro Motoki <amotoki@gmail.com> Workflow+1: Akihiro Motoki <amotoki@gmail.com> Verified+2: Jenkins Submitted-by: Jenkins Submitted-at: Tue, 18 Jul 2017 15:06:39 +0000 Reviewed-on: https://review.openstack.org/484722 Project: openstack/django_openstack_auth Branch: refs/heads/master
-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