Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5f9373f

Browse files
committed
add missing external_id property to the import users job
1 parent 1d895a7 commit 5f9373f

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

auth0/v3/management/jobs.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33

44
class Jobs(object):
5-
65
"""Auth0 jobs endpoints
76
87
Args:
@@ -72,7 +71,7 @@ def export_users(self, body):
7271
"""
7372
return self.client.post(self._url('users-exports'), data=body)
7473

75-
def import_users(self, connection_id, file_obj, upsert=False, send_completion_email=True):
74+
def import_users(self, connection_id, file_obj, upsert=False, send_completion_email=True, external_id=None):
7675
"""Imports users to a connection from a file.
7776
7877
Args:
@@ -91,12 +90,15 @@ def import_users(self, connection_id, file_obj, upsert=False, send_completion_em
9190
send_completion_email (bool): When set to True, an email will be sent to notify the completion of this job.
9291
When set to False, no email will be sent. Defaults to True.
9392
93+
external_id (str): Customer-defined ID.
94+
9495
See: https://auth0.com/docs/api/management/v2#!/Jobs/post_users_imports
9596
"""
9697
return self.client.file_post(self._url('users-imports'),
9798
data={'connection_id': connection_id,
9899
'upsert': str(upsert).lower(),
99-
'send_completion_email': str(send_completion_email).lower()},
100+
'send_completion_email': str(send_completion_email).lower(),
101+
'external_id': external_id},
100102
files={'users': file_obj})
101103

102104
def send_verification_email(self, body):

auth0/v3/test/management/test_jobs.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,21 +65,21 @@ def test_import_users(self, mock_rc):
6565

6666
mock_instance.file_post.assert_called_with(
6767
'https://domain/api/v2/jobs/users-imports',
68-
data={'connection_id': '1234', 'upsert': 'false', 'send_completion_email': 'true'},
68+
data={'connection_id': '1234', 'upsert': 'false', 'send_completion_email': 'true', 'external_id': None},
6969
files={'users': {}}
7070
)
7171

72-
j.import_users(connection_id='1234', file_obj={}, upsert=True, send_completion_email=False)
72+
j.import_users(connection_id='1234', file_obj={}, upsert=True, send_completion_email=False, external_id="ext-id-123")
7373
mock_instance.file_post.assert_called_with(
7474
'https://domain/api/v2/jobs/users-imports',
75-
data={'connection_id': '1234', 'upsert': 'true', 'send_completion_email': 'false'},
75+
data={'connection_id': '1234', 'upsert': 'true', 'send_completion_email': 'false', 'external_id': 'ext-id-123'},
7676
files={'users': {}}
7777
)
7878

7979
j.import_users(connection_id='1234', file_obj={}, upsert=False, send_completion_email=True)
8080
mock_instance.file_post.assert_called_with(
8181
'https://domain/api/v2/jobs/users-imports',
82-
data={'connection_id': '1234', 'upsert': 'false', 'send_completion_email': 'true'},
82+
data={'connection_id': '1234', 'upsert': 'false', 'send_completion_email': 'true', 'external_id': None},
8383
files={'users': {}}
8484
)
8585

0 commit comments

Comments
 (0)