Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
fountain
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
urz-django
fountain
Commits
23a7cb65
Commit
23a7cb65
authored
May 04, 2017
by
Daniel Klaffenbach
🐍
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change default prefix for API users
parent
c191d56d
Pipeline
#7884
passed with stage
in 55 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
4 deletions
+4
-4
fountain/management/commands/ldap_sync.py
fountain/management/commands/ldap_sync.py
+1
-1
tests/tests.py
tests/tests.py
+3
-3
No files found.
fountain/management/commands/ldap_sync.py
View file @
23a7cb65
...
...
@@ -7,7 +7,7 @@ from django.core.management.base import BaseCommand
from
fountain.ldap
import
Ldap
class
Command
(
BaseCommand
):
DEFAULT_EXCLUDE_REGEX
=
r'^api
:
'
DEFAULT_EXCLUDE_REGEX
=
r'^api
-
'
help
=
"Updates the attributes of all Django users from the LDAP server."
def
add_arguments
(
self
,
parser
):
...
...
tests/tests.py
View file @
23a7cb65
...
...
@@ -113,7 +113,7 @@ class LdapTestCase(TestCase):
with
self
.
settings
(
LDAP_SYNC_IS_ACTIVE
=
True
):
self
.
USER_MODEL
.
objects
.
create
(
username
=
'test'
,
is_active
=
False
)
self
.
USER_MODEL
.
objects
.
create
(
username
=
'alice'
,
is_active
=
False
)
self
.
USER_MODEL
.
objects
.
create
(
username
=
'api
:
not_in_ldap'
,
is_active
=
True
)
self
.
USER_MODEL
.
objects
.
create
(
username
=
'api
-
not_in_ldap'
,
is_active
=
True
)
# Clear user attributes for this test
self
.
USER_MODEL
.
objects
.
all
().
update
(
first_name
=
''
,
last_name
=
''
,
email
=
''
)
...
...
@@ -125,12 +125,12 @@ class LdapTestCase(TestCase):
self
.
assertTrue
(
user
.
is_active
)
user
=
self
.
USER_MODEL
.
objects
.
get
(
username
=
'alice'
)
self
.
assertFalse
(
user
.
is_active
)
user
=
self
.
USER_MODEL
.
objects
.
get
(
username
=
'api
:
not_in_ldap'
)
user
=
self
.
USER_MODEL
.
objects
.
get
(
username
=
'api
-
not_in_ldap'
)
self
.
assertTrue
(
user
.
is_active
)
# Check if output matches
output_lines
=
set
(
stdout
.
getvalue
().
splitlines
())
self
.
assertIn
(
"Ignoring api
:
not_in_ldap"
,
output_lines
)
self
.
assertIn
(
"Ignoring api
-
not_in_ldap"
,
output_lines
)
self
.
assertIn
(
"Ignoring alice"
,
output_lines
)
def
test_invalid_user
(
self
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment