Skip to content

Commit e2ab676

Browse files
committed
fix tests via mocking get
1 parent 369cc94 commit e2ab676

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

python/lib/sift_client/_tests/sift_types/test_job.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ def mock_job(mock_client):
3737
job_details=DataImportDetails(data_import_id="import123"),
3838
)
3939
job._apply_client_to_instance(mock_client)
40+
# Configure mock to return the job itself when refresh is called
41+
mock_client.jobs.get.return_value = job
4042
return job
4143

4244

@@ -59,6 +61,8 @@ def mock_finished_job(mock_client):
5961
job_details=DataImportDetails(data_import_id="import123"),
6062
)
6163
job._apply_client_to_instance(mock_client)
64+
# Configure mock to return the job itself when refresh is called
65+
mock_client.jobs.get.return_value = job
6266
return job
6367

6468

@@ -81,6 +85,8 @@ def mock_failed_job(mock_client):
8185
job_details=DataExportDetails(storage_key="exports/failed.csv"),
8286
)
8387
job._apply_client_to_instance(mock_client)
88+
# Configure mock to return the job itself when refresh is called
89+
mock_client.jobs.get.return_value = job
8490
return job
8591

8692

@@ -103,6 +109,8 @@ def mock_cancelled_job(mock_client):
103109
job_details=RuleEvaluationDetails(report_id="report123"),
104110
)
105111
job._apply_client_to_instance(mock_client)
112+
# Configure mock to return the job itself when refresh is called
113+
mock_client.jobs.get.return_value = job
106114
return job
107115

108116

0 commit comments

Comments
 (0)