csv_import: set ou of created users (#34253)

This commit is contained in:
Benjamin Dauvergne 2019-06-24 10:42:16 +02:00
parent 06b729b41e
commit 1ecaa8ccaf
2 changed files with 4 additions and 1 deletions

View File

@ -538,7 +538,7 @@ class UserCsvImporter(object):
return False
if not user:
user = User()
user = User(ou=self.ou)
for cell in row.cells:
if not cell.header.field:

View File

@ -153,6 +153,7 @@ x,x,x,x'''
assert User.objects.count() == 2
thomas = User.objects.get(email='tnoel@entrouvert.com')
assert thomas.ou == get_default_ou()
assert thomas.email_verified is True
assert thomas.first_name == 'Thomas'
assert thomas.attributes.first_name == 'Thomas'
@ -161,6 +162,7 @@ x,x,x,x'''
assert thomas.attributes.phone == '1234'
fpeters = User.objects.get(email='fpeters@entrouvert.com')
assert fpeters.ou == get_default_ou()
assert fpeters.first_name == 'Frédéric'
assert fpeters.email_verified is True
assert fpeters.attributes.first_name == 'Frédéric'
@ -376,6 +378,7 @@ app1,2,tnoel@entrouvert.com,Thomas,Noël,1234
userexternalid__source='app1',
userexternalid__external_id=external_id)
assert thomas.ou == get_default_ou()
assert thomas.email_verified is True
assert thomas.first_name == 'Thomas'
assert thomas.attributes.first_name == 'Thomas'