Skip to content

Commit

Permalink
Fixing lints
Browse files Browse the repository at this point in the history
  • Loading branch information
etianen committed Jan 15, 2024
1 parent 7b18cb3 commit 23a228e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ docs/_build
*.sqlite3
.coverage
*.egg-info
.venv
4 changes: 1 addition & 3 deletions django_python3_ldap/ldap.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
"""
Low-level LDAP hooks.
"""
import ssl

import ldap3
from ldap3.core.exceptions import LDAPException
Expand Down Expand Up @@ -148,7 +147,7 @@ def get_tls_options(settings):
return None

if settings.LDAP_AUTH_TLS_VALIDATE_CERT:
tls_options['validate'] = settings.LDAP_AUTH_TLS_VALIDATE_CERT
tls_options['validate'] = settings.LDAP_AUTH_TLS_VALIDATE_CERT

if settings.LDAP_AUTH_TLS_CA_CERTS_FILE:
tls_options['ca_certs_file'] = settings.LDAP_AUTH_TLS_CA_CERTS_FILE
Expand All @@ -162,7 +161,6 @@ def get_tls_options(settings):
return (ldap3.Tls(**tls_options))



@contextmanager
def connection(**kwargs):
"""
Expand Down
8 changes: 3 additions & 5 deletions django_python3_ldap/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from __future__ import unicode_literals

import ssl
from unittest import skipUnless, skip
from unittest import skipUnless
from io import StringIO

from django.test import TestCase, override_settings
Expand Down Expand Up @@ -117,7 +117,6 @@ def testRepeatedUserAuthenticationDoestRecreateUsers(self):
# Ensure that the user isn't recreated on second access.
self.assertEqual(user_1.pk, user_2.pk)


def testAuthenticateWithRebind(self):
with self.settings(
LDAP_AUTH_CONNECTION_USERNAME=settings.LDAP_AUTH_TEST_USER_USERNAME,
Expand Down Expand Up @@ -418,8 +417,8 @@ def setUp(self):

def testSyncUsersCreatesUsers(self):
with self.settings(
LDAP_AUTH_ATTRIBUTES=['givenName', "homeDirectory", "uid"],
LDAP_AUTH_USER_FIELDS={
LDAP_AUTH_ATTRIBUTES=['givenName', "homeDirectory", "uid"],
LDAP_AUTH_USER_FIELDS={
"username": "uid",
"first_name": "givenName",
"last_name": "homeDirectory",
Expand All @@ -436,7 +435,6 @@ def testSyncUsersCreatesUsers(self):
self.assertEqual(user.email, '')



@skipUnless(settings.LDAP_AUTH_TEST_USER_USERNAME, "No settings.LDAP_AUTH_TEST_USER_USERNAME supplied.")
@skipUnless(settings.LDAP_AUTH_TEST_USER_PASSWORD, "No settings.LDAP_AUTH_TEST_USER_PASSWORD supplied.")
@skipUnless(settings.LDAP_AUTH_USER_LOOKUP_FIELDS == ("username",), "Cannot test using custom lookup fields.")
Expand Down

0 comments on commit 23a228e

Please sign in to comment.