File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11from .rest import RestClient
2+ import warnings
23
34
45class 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.
Original file line number Diff line number Diff 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' )
You can’t perform that action at this time.
0 commit comments