File tree Expand file tree Collapse file tree 1 file changed +24
-1
lines changed Expand file tree Collapse file tree 1 file changed +24
-1
lines changed Original file line number Diff line number Diff line change 11import json
22import re
3+ from re import Pattern
34
45from 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+
1336def test_get_run_pagination_with_tasks (config , requests_mock ):
1437 run1 = {
1538 "tasks" : [{
You can’t perform that action at this time.
0 commit comments