File tree Expand file tree Collapse file tree 3 files changed +36
-0
lines changed
Expand file tree Collapse file tree 3 files changed +36
-0
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ async def search_dashboards(
1919 folder_uids = None ,
2020 starred = None ,
2121 limit = None ,
22+ page = None ,
2223 ):
2324 """
2425
@@ -31,6 +32,7 @@ async def search_dashboards(
3132 :param folder_uids:
3233 :param starred:
3334 :param limit:
35+ :param page:
3436 :return:
3537 """
3638 list_dashboard_path = "/search"
@@ -63,4 +65,7 @@ async def search_dashboards(
6365 if limit :
6466 params ["limit" ] = limit
6567
68+ if page :
69+ params ["page" ] = page
70+
6671 return await self .client .GET (list_dashboard_path , params = params )
Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ def search_dashboards(
1919 folder_uids = None ,
2020 starred = None ,
2121 limit = None ,
22+ page = None ,
2223 ):
2324 """
2425
@@ -31,6 +32,7 @@ def search_dashboards(
3132 :param folder_uids:
3233 :param starred:
3334 :param limit:
35+ :param page:
3436 :return:
3537 """
3638 list_dashboard_path = "/search"
@@ -63,4 +65,7 @@ def search_dashboards(
6365 if limit :
6466 params ["limit" ] = limit
6567
68+ if page :
69+ params ["page" ] = page
70+
6671 return self .client .GET (list_dashboard_path , params = params )
Original file line number Diff line number Diff line change @@ -51,3 +51,29 @@ def test_search_dashboards_with_out_filter(self, m):
5151
5252 with self .assertRaises (GrafanaBadInputError ):
5353 self .grafana .search .search_dashboards ()
54+
55+ @requests_mock .Mocker ()
56+ def test_search_dashboards_with_page (self , m ):
57+ m .get (
58+ "http://localhost/api/search?page=1" ,
59+ json = [
60+ {
61+ "id" : 2307 ,
62+ "uid" : "LfQAz3t4z1DSA" ,
63+ "title" : "ERRORS" ,
64+ "uri" : "db/errors" ,
65+ "url" : "/d/LfQAz3t4z1DSA/errors" ,
66+ "slug" : "" ,
67+ "type" : "dash-db" ,
68+ "tags" : [],
69+ "isStarred" : False ,
70+ "sortMeta" : 0 ,
71+ }
72+ ],
73+ )
74+
75+ result = self .grafana .search .search_dashboards (
76+ page = 1 ,
77+ )
78+ self .assertEqual (result [0 ]["id" ], 2307 )
79+ self .assertEqual (len (result ), 1 )
You can’t perform that action at this time.
0 commit comments