Skip to content

Commit 4f74c18

Browse files
authored
feat: Add license info (#75)
* feat: Add license info * fix: Adjust the Snapshot API
1 parent 199b12a commit 4f74c18

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

grafana_api/snapshot.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ def create_new_snapshot(
7575
json.dumps(snapshot_json),
7676
)
7777

78-
if api_call == dict() or api_call.get("id") is None:
78+
if api_call == dict() or (api_call.get("id") is None and api_call.get("key") is None):
7979
logging.error(f"Check the error: {api_call}.")
8080
raise Exception
8181
else:

setup.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
"License :: OSI Approved",
2626
"Operating System :: OS Independent",
2727
],
28+
license="Apache-2.0 License",
2829
packages=["grafana_api"],
2930
install_requires=["httpx"],
3031
extras_require={

tests/integrationtest/test_snapshot.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def test_a_create_new_snapshot(self):
2121
self.dashboard.get_dashboard_by_uid("tests").get("dashboard"),
2222
name="TestSnapshot1",
2323
)
24-
self.assertIsNotNone(snapshot.get("id"))
24+
self.assertIsNotNone(snapshot.get("key"))
2525

2626
def test_get_snapshots(self):
2727
self.assertEqual(1, len(self.snapshot.get_snapshots()))
@@ -32,12 +32,13 @@ def test_get_snapshot_by_key(self):
3232
self.snapshot.get_snapshot_by_key(snapshot_key).get("dashboard").get("id")
3333
)
3434

35-
def test_b_delete_snapshot_by_key(self):
35+
def test_d_delete_snapshot_by_key(self):
36+
print(self.snapshot.get_snapshots())
3637
snapshot_key: str = self.snapshot.get_snapshots()[1].get("key")
3738
self.snapshot.delete_snapshot_by_key(snapshot_key)
3839
self.assertEqual(1, len(self.snapshot.get_snapshots()))
3940

40-
def test_c_delete_snapshot_by_delete_key(self):
41+
def test_e_delete_snapshot_by_delete_key(self):
4142
snapshot: dict = self.snapshot.create_new_snapshot(
4243
self.dashboard.get_dashboard_by_uid("tests").get("dashboard"),
4344
name="TestSnapshot2",

0 commit comments

Comments
 (0)