...
 
Commits (2)
......@@ -6,31 +6,15 @@ before_script:
- python3.6 -m venv $HOME/tox
- $HOME/tox/bin/pip install tox
py27-django18:
stage: test
script: $HOME/tox/bin/tox -e 'py27-django18'
py27-django110:
stage: test
script: $HOME/tox/bin/tox -e 'py27-django110'
py27-django111:
stage: test
script: $HOME/tox/bin/tox -e 'py27-django111'
py36-django18:
stage: test
script: $HOME/tox/bin/tox -e 'py36-django18'
py36-django110:
stage: test
script: $HOME/tox/bin/tox -e 'py36-django110'
py36-django111:
stage: test
script: $HOME/tox/bin/tox -e 'py36-django111'
py36-django20:
py36-django22:
stage: test
script: $HOME/tox/bin/tox -e 'py36-django22'
py36-django30:
stage: test
script: $HOME/tox/bin/tox -e 'py36-django20'
script: $HOME/tox/bin/tox -e 'py36-django30'
......@@ -5,6 +5,7 @@ from django.contrib.auth import get_user_model
from django.db.models.signals import pre_save
from .ldap import Ldap
def set_attributes_from_ldap(sender, instance, **kwargs):
l = Ldap()
username = getattr(instance, instance.USERNAME_FIELD)
......
......@@ -3,7 +3,7 @@ from __future__ import unicode_literals
import getpass
from django.core.management.base import BaseCommand
from django.contrib.auth import get_user_model
from django.utils.six import moves
class Command(BaseCommand):
help = "Used to create a superuser without a usable password."
......@@ -23,7 +23,7 @@ class Command(BaseCommand):
username = options.get('username')
if not username:
current_user = getpass.getuser()
input_user = moves.input('Username [{}]: '.format(current_user))
input_user = input('Username [{}]: '.format(current_user))
if not input_user:
username = current_user
else:
......
......@@ -171,7 +171,7 @@
"top"
],
"sn": [
"This User Has A Very Long Surname Which Exceeds The Maximum Allowed Length"
"This User Has A Very Long Surname Which Exceeds The Maximum Allowed Length. This is only required for testing. This User Has A Very Long Surname Which Exceeds The Maximum Allowed Length. This is only required for testing."
],
"uid": [
"long"
......
......@@ -26,7 +26,8 @@ INSTALLED_APPS = (
'tests'
)
MIDDLEWARE = (
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
......@@ -34,10 +35,25 @@ MIDDLEWARE = (
'django.contrib.auth.middleware.RemoteUserMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'django.middleware.security.SecurityMiddleware',
)
# compat for Django 1.8
MIDDLEWARE_CLASSES = MIDDLEWARE
]
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]
ROOT_URLCONF = 'tests.urls'
......
......@@ -13,6 +13,7 @@ from django.test.utils import override_settings
_CURRENT_DIRECTORY = os.path.dirname(os.path.realpath(__file__))
_LDAP_FAKE_DATA_LOCATION = os.path.join(_CURRENT_DIRECTORY, 'test_ldap_data.json')
@override_settings(
LDAP_SYNC_URI='ldap://localhost/ou=Users,dc=example,dc=org',
LDAP_TESTING_FAKE_DATA=_LDAP_FAKE_DATA_LOCATION
......@@ -37,7 +38,6 @@ class LdapTestCase(TestCase):
self.assertEquals(user.last_name, 'User')
self.assertEquals(user.email, 'test@example.org')
def test_autocreate(self):
response = self.client.get('/admin/')
self.assertEquals(response.status_code, 302)
......@@ -146,7 +146,7 @@ class LdapTestCase(TestCase):
the equivalent Django field, are cut off properly.
"""
last_name_field = self.USER_MODEL._meta.get_field('last_name')
if last_name_field.max_length >= 74:
if last_name_field.max_length >= 200:
self.skipTest("The `max_length` of the `last_name` field is too large for this test.")
user = self.USER_MODEL.objects.create(username='long')
......
......@@ -5,8 +5,9 @@
[tox]
skipsdist = true
envlist = py{27,36}-django{18,110,111},
py{36}-django{20}
skip_missing_interpreters = true
envlist = py{36}-django{111,22,30},
py37-django{22,30}
[testenv]
......@@ -20,10 +21,9 @@ deps =
lxml
python-dateutil
ldap3
django18: Django >= 1.8, < 1.9
django110: Django >= 1.10, < 1.11
django111: Django >= 1.11, < 2
django20: Django >= 2, < 2.1
django111: Django==1.11.*
django22: Django==2.2.*
django30: Django==3.0.*
setenv =
DJANGO_LIVE_TEST_SERVER_ADDRESS=localhost:9000-9200
......