Skip to content

Commit f9dbde8

Browse files
authored
fix: Adjust the Snapshot API (#65)
1 parent a79c8b9 commit f9dbde8

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

grafana_api/snapshot.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ def get_snapshots(self) -> list:
9898
APIEndpoints.DASHBOARD_SNAPSHOTS.value,
9999
)
100100

101-
if api_call == list() or api_call[0].get("id") is None:
101+
if api_call == list() or api_call[0].get("name") is None:
102102
logging.error(f"Check the error: {api_call}.")
103103
raise Exception
104104
else:

tests/integrationtest/test_folder.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ def test_get_folder_by_uids(self):
3131
"createdBy": "[email protected]",
3232
"hasAcl": True,
3333
"id": 72,
34+
"orgId": 0,
3435
"title": "Github Integrationtest",
3536
"uid": "6U_QdWJnz",
3637
"updated": "2022-01-10T00:24:58+01:00",
@@ -52,6 +53,7 @@ def test_get_folder_by_id(self):
5253
"createdBy": "[email protected]",
5354
"hasAcl": True,
5455
"id": 72,
56+
"orgId": 0,
5557
"title": "Github Integrationtest",
5658
"uid": "6U_QdWJnz",
5759
"updated": "2022-01-10T00:24:58+01:00",

tests/unittests/test_snapshot.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,9 @@ def test_get_snapshots(self, call_the_api_mock):
6060
model: APIModel = APIModel(host=MagicMock(), token=MagicMock())
6161
snapshot: Snapshot = Snapshot(grafana_api_model=model)
6262

63-
call_the_api_mock.return_value = list([{"id": 1}])
63+
call_the_api_mock.return_value = list([{"name": "Test"}])
6464

65-
self.assertEqual(list([{"id": 1}]), snapshot.get_snapshots())
65+
self.assertEqual(list([{"name": "Test"}]), snapshot.get_snapshots())
6666

6767
@patch("grafana_api.api.Api.call_the_api")
6868
def test_get_snapshots_no_snapshots_available(self, call_the_api_mock):

0 commit comments

Comments
 (0)