Commit 23a7cb65 authored by Daniel Klaffenbach's avatar Daniel Klaffenbach 🐍

Change default prefix for API users

parent c191d56d
Pipeline #7884 passed with stage
in 55 seconds
......@@ -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):
......
......@@ -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):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment