Skip to content

Commit 73290ea

Browse files
committed
re-route job results
1 parent 036494e commit 73290ea

2 files changed

Lines changed: 13 additions & 7 deletions

File tree

auth0/v3/management/jobs.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from .rest import RestClient
2+
import warnings
23

34

45
class Jobs(object):
@@ -56,10 +57,14 @@ def get_results(self, job_id):
5657
Args:
5758
job_id (str): The id of the job.
5859
59-
See: https://auth0.com/docs/api/management/v2#!/Jobs/get_results
60+
Deprecation:
61+
The /jobs/{id}/results endpoint was removed from the Management API.
62+
You can obtain the Job results by querying a Job by ID.
63+
64+
See: https://auth0.com/docs/api/management/v2#!/Jobs/get_jobs_by_id
6065
"""
61-
url = self._url('%s/results' % job_id)
62-
return self.client.get(url)
66+
warnings.warn("/jobs/{id}/results is no longer available. The get(id) function will be called instead.", DeprecationWarning)
67+
return self.get(job_id)
6368

6469
def export_users(self, body):
6570
"""Export all users to a file using a long running job.

auth0/v3/test/management/test_jobs.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,25 +23,26 @@ def test_get(self, mock_rc):
2323
)
2424

2525
@mock.patch('auth0.v3.management.jobs.RestClient')
26-
def get_failed_job(self, mock_rc):
26+
def test_get_failed_job(self, mock_rc):
2727
mock_instance = mock_rc.return_value
2828

2929
j = Jobs(domain='domain', token='jwttoken')
30-
j.get('an-id')
30+
j.get_failed_job('an-id')
3131

3232
mock_instance.get.assert_called_with(
3333
'https://domain/api/v2/jobs/an-id/errors',
3434
)
3535

3636
@mock.patch('auth0.v3.management.jobs.RestClient')
37-
def get_job_results(self, mock_rc):
37+
def test_get_job_results(self, mock_rc):
3838
mock_instance = mock_rc.return_value
3939

4040
j = Jobs(domain='domain', token='jwttoken')
4141
j.get('an-id')
4242

43+
# Should use the 'get by id' URL
4344
mock_instance.get.assert_called_with(
44-
'https://domain/api/v2/jobs/an-id/results',
45+
'https://domain/api/v2/jobs/an-id',
4546
)
4647

4748
@mock.patch('auth0.v3.management.jobs.RestClient')

0 commit comments

Comments
 (0)