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)
downloaddjango_openstack_auth-601e1ad44c18b9665c2ec6886438299de72d3761.tar.gz
Fix Django 1.11 Compatibility
Implements: blueprint dj111 Change-Id: Idfaef58b2a069006f6d792e43041dd136097c413 Co-Authored-By: Adrian Turjak <adriant@catalyst.net.nz>
-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