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):
|
||||
fields = options['clipper_field'].split('.')
|
||||
User = get_user_model()
|
||||
|
||||
|
||||
def get_subattr(obj, fields):
|
||||
# Allows to follow OneToOne relationships
|
||||
if len(fields) == 1:
|
||||
return getattr(obj, fields[0])
|
||||
return get_subattr(getattr(obj, fields[0]), fields[1:])
|
||||
|
||||
|
||||
accounts = {get_subattr(account, fields): account for account in
|
||||
User.objects.all()}
|
||||
else:
|
||||
accounts = None
|
||||
|
||||
|
||||
logs = install_longterm_adapter(fake, accounts)
|
||||
|
||||
self.stdout.write("Social accounts created : %d"
|
||||
|
|
|
@ -361,7 +361,7 @@ class LongTermClipperTests(CASTestCase):
|
|||
self.assertEqual(nsa1, nsa0)
|
||||
self.assertEqual(user1.username, "test@12")
|
||||
self.assertEqual(conn.extra_data['ldap']['entrance_year'], '12')
|
||||
|
||||
|
||||
def test_longterm_installer_from_allauth_command_socialaccounts(self):
|
||||
self._setup_ldap(12)
|
||||
with self.settings(
|
||||
|
@ -384,7 +384,7 @@ class LongTermClipperTests(CASTestCase):
|
|||
output = stdout.getvalue()
|
||||
self.assertIn('test -> test@12', output)
|
||||
self.assertNotIn('bidule ->', output)
|
||||
|
||||
|
||||
r = self.client_cas_login(self.client, provider_id="clipper",
|
||||
username='test')
|
||||
user1 = r.context["user"]
|
||||
|
@ -395,7 +395,7 @@ class LongTermClipperTests(CASTestCase):
|
|||
self.assertEqual(nsa1, nsa0)
|
||||
self.assertEqual(user1.username, "test@12")
|
||||
self.assertEqual(conn.extra_data['ldap']['entrance_year'], '12')
|
||||
|
||||
|
||||
def test_longterm_installer_from_djangocas(self):
|
||||
with self.settings(
|
||||
SOCIALACCOUNT_ADAPTER='allauth.socialaccount.'
|
||||
|
|
Loading…
Reference in a new issue