Skip to content

Commit 12bd298

Browse files
committed
Add new test
1 parent 0465c5f commit 12bd298

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

tests/test_jobs_mixin.py

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,38 @@
11
import json
22
import re
3+
from re import Pattern
34

45
from databricks.sdk import WorkspaceClient
56

67

7-
def make_path_pattern(run_id: int, page_token: str) -> str:
8+
def make_path_pattern(run_id: int, page_token: str) -> Pattern[str]:
89
return re.compile(
910
f'{re.escape("http://localhost/api/")}2.\d{re.escape(f"/jobs/runs/get?page_token={page_token}&run_id={run_id}")}'
1011
)
1112

1213

14+
def test_get_run_with_no_pagination(config, requests_mock):
15+
run1 = {
16+
"tasks": [{
17+
"run_id": 0
18+
}, {
19+
"run_id": 1
20+
}],
21+
}
22+
requests_mock.get(make_path_pattern(1337, "initialToken"), text=json.dumps(run1))
23+
w = WorkspaceClient(config=config)
24+
25+
run = w.jobs.get_run(1337, page_token="initialToken")
26+
27+
assert run.as_dict() == {
28+
"tasks": [{
29+
'run_id': 0
30+
}, {
31+
'run_id': 1
32+
}],
33+
}
34+
35+
1336
def test_get_run_pagination_with_tasks(config, requests_mock):
1437
run1 = {
1538
"tasks": [{

0 commit comments

Comments
 (0)