flake8
This commit is contained in:
parent
2c57fb7a4d
commit
126f367e76
2 changed files with 6 additions and 6 deletions
|
@ -43,18 +43,18 @@ class Command(BaseCommand):
|
||||||
elif options.get('clipper_field', None):
|
elif options.get('clipper_field', None):
|
||||||
fields = options['clipper_field'].split('.')
|
fields = options['clipper_field'].split('.')
|
||||||
User = get_user_model()
|
User = get_user_model()
|
||||||
|
|
||||||
def get_subattr(obj, fields):
|
def get_subattr(obj, fields):
|
||||||
# Allows to follow OneToOne relationships
|
# Allows to follow OneToOne relationships
|
||||||
if len(fields) == 1:
|
if len(fields) == 1:
|
||||||
return getattr(obj, fields[0])
|
return getattr(obj, fields[0])
|
||||||
return get_subattr(getattr(obj, fields[0]), fields[1:])
|
return get_subattr(getattr(obj, fields[0]), fields[1:])
|
||||||
|
|
||||||
accounts = {get_subattr(account, fields): account for account in
|
accounts = {get_subattr(account, fields): account for account in
|
||||||
User.objects.all()}
|
User.objects.all()}
|
||||||
else:
|
else:
|
||||||
accounts = None
|
accounts = None
|
||||||
|
|
||||||
logs = install_longterm_adapter(fake, accounts)
|
logs = install_longterm_adapter(fake, accounts)
|
||||||
|
|
||||||
self.stdout.write("Social accounts created : %d"
|
self.stdout.write("Social accounts created : %d"
|
||||||
|
|
|
@ -361,7 +361,7 @@ class LongTermClipperTests(CASTestCase):
|
||||||
self.assertEqual(nsa1, nsa0)
|
self.assertEqual(nsa1, nsa0)
|
||||||
self.assertEqual(user1.username, "test@12")
|
self.assertEqual(user1.username, "test@12")
|
||||||
self.assertEqual(conn.extra_data['ldap']['entrance_year'], '12')
|
self.assertEqual(conn.extra_data['ldap']['entrance_year'], '12')
|
||||||
|
|
||||||
def test_longterm_installer_from_allauth_command_socialaccounts(self):
|
def test_longterm_installer_from_allauth_command_socialaccounts(self):
|
||||||
self._setup_ldap(12)
|
self._setup_ldap(12)
|
||||||
with self.settings(
|
with self.settings(
|
||||||
|
@ -384,7 +384,7 @@ class LongTermClipperTests(CASTestCase):
|
||||||
output = stdout.getvalue()
|
output = stdout.getvalue()
|
||||||
self.assertIn('test -> test@12', output)
|
self.assertIn('test -> test@12', output)
|
||||||
self.assertNotIn('bidule ->', output)
|
self.assertNotIn('bidule ->', output)
|
||||||
|
|
||||||
r = self.client_cas_login(self.client, provider_id="clipper",
|
r = self.client_cas_login(self.client, provider_id="clipper",
|
||||||
username='test')
|
username='test')
|
||||||
user1 = r.context["user"]
|
user1 = r.context["user"]
|
||||||
|
@ -395,7 +395,7 @@ class LongTermClipperTests(CASTestCase):
|
||||||
self.assertEqual(nsa1, nsa0)
|
self.assertEqual(nsa1, nsa0)
|
||||||
self.assertEqual(user1.username, "test@12")
|
self.assertEqual(user1.username, "test@12")
|
||||||
self.assertEqual(conn.extra_data['ldap']['entrance_year'], '12')
|
self.assertEqual(conn.extra_data['ldap']['entrance_year'], '12')
|
||||||
|
|
||||||
def test_longterm_installer_from_djangocas(self):
|
def test_longterm_installer_from_djangocas(self):
|
||||||
with self.settings(
|
with self.settings(
|
||||||
SOCIALACCOUNT_ADAPTER='allauth.socialaccount.'
|
SOCIALACCOUNT_ADAPTER='allauth.socialaccount.'
|
||||||
|
|
Loading…
Reference in a new issue