Skip to content

Commit

Permalink
fix: Adjust the integration tests (#85)
Browse files Browse the repository at this point in the history
  • Loading branch information
ZPascal authored May 30, 2024
1 parent bfc5b3e commit afeb960
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 268 deletions.
17 changes: 14 additions & 3 deletions tests/integrationtest/test_alerting.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,16 @@ def test_c_delete_alertmanager_config(self):
"group_by": ["grafana_folder", "alertname"],
"receiver": "grafana-default-email",
"provenance": "api",
"routes": [{"object_matchers": [["__grafana_autogenerated__",
"=",
"true"]],
"receiver": "grafana-default-email",
"routes": [{"group_by": ["grafana_folder",
"alertname"],
"object_matchers": [["__grafana_receiver__",
"=",
"grafana-default-email"]],
"receiver": "grafana-default-email"}]}]
},
"templates": None,
"receivers": [
Expand All @@ -83,8 +93,9 @@ def test_c_delete_alertmanager_config(self):
],
}
],
},
}
}

self.assertEqual(result, self.alerting.get_alertmanager_config())

def test_test_alertmanager_receivers(self):
Expand Down Expand Up @@ -127,8 +138,8 @@ def test_get_prometheus_alerts(self):

for i in range(0, MAX_TRIES):
if (
len(self.alerting.get_prometheus_alerts().get("data").get("alerts"))
!= 0
len(self.alerting.get_prometheus_alerts().get("data").get("alerts"))
!= 0
):
time.sleep(0.1 + i / 2)
self.assertEqual(
Expand Down
252 changes: 0 additions & 252 deletions tests/integrationtest/test_alerting_notifications.py

This file was deleted.

12 changes: 6 additions & 6 deletions tests/integrationtest/test_folder.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@ def test_get_folder_by_uids(self):
"canEdit": True,
"canSave": True,
"created": "2022-01-10T00:24:58+01:00",
"createdBy": "[email protected]",
"hasAcl": True,
"createdBy": "Anonymous",
"hasAcl": False,
"id": 72,
"orgId": 0,
"title": "Github Integrationtest",
"uid": "6U_QdWJnz",
"updated": "2022-01-10T00:24:58+01:00",
"updatedBy": "[email protected]",
"updatedBy": "Anonymous",
"url": "/dashboards/f/6U_QdWJnz/github-integrationtest",
"version": 1,
},
Expand All @@ -50,14 +50,14 @@ def test_get_folder_by_id(self):
"canEdit": True,
"canSave": True,
"created": "2022-01-10T00:24:58+01:00",
"createdBy": "[email protected]",
"hasAcl": True,
"createdBy": "Anonymous",
"hasAcl": False,
"id": 72,
"orgId": 0,
"title": "Github Integrationtest",
"uid": "6U_QdWJnz",
"updated": "2022-01-10T00:24:58+01:00",
"updatedBy": "[email protected]",
"updatedBy": "Anonymous",
"url": "/dashboards/f/6U_QdWJnz/github-integrationtest",
"version": 1,
},
Expand Down
14 changes: 7 additions & 7 deletions tests/integrationtest/test_organisation.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ def test_get_all_users_by_the_current_organization(self):
self.organisation.get_all_users_by_the_current_organization()
)

self.assertEqual(4, organisation_users[1].get("userId"))
self.assertEqual(8, organisation_users[0].get("userId"))

def test_get_all_users_by_the_current_organization_lookup(self):
organisation_users: list = (
self.organisation.get_all_users_by_the_current_organization_lookup()
)

self.assertEqual(4, organisation_users[1].get("userId"))
self.assertEqual(8, organisation_users[0].get("userId"))

def test_a_update_current_organization(self):
self.organisation.update_current_organization("Test")
Expand All @@ -55,19 +55,19 @@ def test_a_add_new_user_to_current_organization(self):
organisation_users: list = (
self.organisation.get_all_users_by_the_current_organization_lookup()
)
self.assertEqual("Test", organisation_users[2].get("login"))
self.assertEqual("[email protected]", organisation_users[1].get("login"))

def test_b_update_organization_user_role_by_user_id(self):
self.organisation.update_organization_user_role_by_user_id(7, "Editor")
self.organisation.update_organization_user_role_by_user_id(1967, "Editor")

organisation_users: list = (
self.organisation.get_all_users_by_the_current_organization()
)
self.assertEqual(7, organisation_users[2].get("userId"))
self.assertEqual("Editor", organisation_users[2].get("role"))
self.assertEqual(1967, organisation_users[1].get("userId"))
self.assertEqual("Editor", organisation_users[1].get("role"))

def test_c_delete_organization_user_by_user_id(self):
self.organisation.delete_organization_user_by_user_id(7)
self.organisation.delete_organization_user_by_user_id(1967)

organisation_users: list = (
self.organisation.get_all_users_by_the_current_organization()
Expand Down

0 comments on commit afeb960

Please sign in to comment.