Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions grafana_api/correlations.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ def create_correlations(self, correlation_object: CorrelationObject) -> dict:
"targetUID": correlation_object.target_datasource_uid,
"label": correlation_object.label,
"description": correlation_object.description,
"type": correlation_object.config_type,
"config": {
"type": correlation_object.config_type,
"field": correlation_object.config_field,
Expand Down
2 changes: 1 addition & 1 deletion tests/integrationtest/test_alerting_provisioning.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ def test_l_delete_contact_point(self):

def test_m_get_all_mute_timings(self):
self.assertEqual(
"test1", self.alerting_provisioning.get_all_mute_timings()[0].get("name")
"test1", self.alerting_provisioning.get_all_mute_timings()[1].get("name")
)

def test_n_get_mute_timing(self):
Expand Down
35 changes: 0 additions & 35 deletions tests/integrationtest/test_authentication.py

This file was deleted.

1 change: 0 additions & 1 deletion tests/integrationtest/test_correlations.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ def test_b_correlations_lifecycle(self):
)

def test_c_delete_data_source(self):
pass
self.assertEqual(
None, self.data_source.delete_datasource_by_name("TestData DB 1")
)
31 changes: 3 additions & 28 deletions tests/integrationtest/test_service_account.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

from grafana_api.model import APIModel
from grafana_api.service_account import ServiceAccount
from grafana_api.authentication import Authentication


class ServiceAccountTest(TestCase):
Expand All @@ -14,7 +13,6 @@ class ServiceAccountTest(TestCase):
http2_support=True if os.environ["HTTP2"] == "True" else False,
)
service_account: ServiceAccount = ServiceAccount(grafana_api_model=model)
authentication: Authentication = Authentication(grafana_api_model=model)

def test_lifecycle_service_account(self):
service_account: dict = self.service_account.create_service_account(
Expand Down Expand Up @@ -64,36 +62,13 @@ def test_lifecycle_service_account(self):
service_account.get("id")
),
)
self.authentication.create_api_token("Test-all-migrated", "Viewer")
self.service_account.migrate_api_keys_to_service_accounts()
self.assertEqual(list(), self.authentication.get_api_tokens())
self.assertEqual(
3, len(self.service_account.search_service_account().get("serviceAccounts"))
)
service_account_all_migrated: dict = (
self.service_account.search_service_account(query="Test-all-migrated")
)
self.service_account.delete_service_account(
service_account_all_migrated.get("serviceAccounts")[0].get("id")
)

token: dict = self.authentication.create_api_token("Test-migrated", "Viewer")
self.service_account.migrate_api_key_to_service_account(token.get("id"))
self.assertEqual(
3, len(self.service_account.search_service_account().get("serviceAccounts"))
)
service_account_migrated: dict = self.service_account.search_service_account(
query="Test-migrated"
)

self.assertEqual(
3, len(self.service_account.search_service_account().get("serviceAccounts"))
2, len(self.service_account.search_service_account().get("serviceAccounts"))
)
self.service_account.create_service_account_token_by_id(service_account.get("id"), "Test", "Viewer")
self.assertEqual(1, self.service_account.search_service_account().get("serviceAccounts")[0].get("tokens"))

self.service_account.delete_service_account(service_account.get("id"))
self.service_account.delete_service_account(
service_account_migrated.get("serviceAccounts")[0].get("id")
)
self.assertEqual(
1, len(self.service_account.search_service_account().get("serviceAccounts"))
)