Skip to content

Commit afeb960

Browse files
authored
fix: Adjust the integration tests (#85)
1 parent bfc5b3e commit afeb960

File tree

4 files changed

+27
-268
lines changed

4 files changed

+27
-268
lines changed

tests/integrationtest/test_alerting.py

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,16 @@ def test_c_delete_alertmanager_config(self):
6666
"group_by": ["grafana_folder", "alertname"],
6767
"receiver": "grafana-default-email",
6868
"provenance": "api",
69+
"routes": [{"object_matchers": [["__grafana_autogenerated__",
70+
"=",
71+
"true"]],
72+
"receiver": "grafana-default-email",
73+
"routes": [{"group_by": ["grafana_folder",
74+
"alertname"],
75+
"object_matchers": [["__grafana_receiver__",
76+
"=",
77+
"grafana-default-email"]],
78+
"receiver": "grafana-default-email"}]}]
6979
},
7080
"templates": None,
7181
"receivers": [
@@ -83,8 +93,9 @@ def test_c_delete_alertmanager_config(self):
8393
],
8494
}
8595
],
86-
},
96+
}
8797
}
98+
8899
self.assertEqual(result, self.alerting.get_alertmanager_config())
89100

90101
def test_test_alertmanager_receivers(self):
@@ -127,8 +138,8 @@ def test_get_prometheus_alerts(self):
127138

128139
for i in range(0, MAX_TRIES):
129140
if (
130-
len(self.alerting.get_prometheus_alerts().get("data").get("alerts"))
131-
!= 0
141+
len(self.alerting.get_prometheus_alerts().get("data").get("alerts"))
142+
!= 0
132143
):
133144
time.sleep(0.1 + i / 2)
134145
self.assertEqual(

tests/integrationtest/test_alerting_notifications.py

Lines changed: 0 additions & 252 deletions
This file was deleted.

tests/integrationtest/test_folder.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,14 @@ def test_get_folder_by_uids(self):
2828
"canEdit": True,
2929
"canSave": True,
3030
"created": "2022-01-10T00:24:58+01:00",
31-
"createdBy": "[email protected]",
32-
"hasAcl": True,
31+
"createdBy": "Anonymous",
32+
"hasAcl": False,
3333
"id": 72,
3434
"orgId": 0,
3535
"title": "Github Integrationtest",
3636
"uid": "6U_QdWJnz",
3737
"updated": "2022-01-10T00:24:58+01:00",
38-
"updatedBy": "[email protected]",
38+
"updatedBy": "Anonymous",
3939
"url": "/dashboards/f/6U_QdWJnz/github-integrationtest",
4040
"version": 1,
4141
},
@@ -50,14 +50,14 @@ def test_get_folder_by_id(self):
5050
"canEdit": True,
5151
"canSave": True,
5252
"created": "2022-01-10T00:24:58+01:00",
53-
"createdBy": "[email protected]",
54-
"hasAcl": True,
53+
"createdBy": "Anonymous",
54+
"hasAcl": False,
5555
"id": 72,
5656
"orgId": 0,
5757
"title": "Github Integrationtest",
5858
"uid": "6U_QdWJnz",
5959
"updated": "2022-01-10T00:24:58+01:00",
60-
"updatedBy": "[email protected]",
60+
"updatedBy": "Anonymous",
6161
"url": "/dashboards/f/6U_QdWJnz/github-integrationtest",
6262
"version": 1,
6363
},

tests/integrationtest/test_organisation.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,14 @@ def test_get_all_users_by_the_current_organization(self):
2626
self.organisation.get_all_users_by_the_current_organization()
2727
)
2828

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

3131
def test_get_all_users_by_the_current_organization_lookup(self):
3232
organisation_users: list = (
3333
self.organisation.get_all_users_by_the_current_organization_lookup()
3434
)
3535

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

3838
def test_a_update_current_organization(self):
3939
self.organisation.update_current_organization("Test")
@@ -55,19 +55,19 @@ def test_a_add_new_user_to_current_organization(self):
5555
organisation_users: list = (
5656
self.organisation.get_all_users_by_the_current_organization_lookup()
5757
)
58-
self.assertEqual("Test", organisation_users[2].get("login"))
58+
self.assertEqual("[email protected]", organisation_users[1].get("login"))
5959

6060
def test_b_update_organization_user_role_by_user_id(self):
61-
self.organisation.update_organization_user_role_by_user_id(7, "Editor")
61+
self.organisation.update_organization_user_role_by_user_id(1967, "Editor")
6262

6363
organisation_users: list = (
6464
self.organisation.get_all_users_by_the_current_organization()
6565
)
66-
self.assertEqual(7, organisation_users[2].get("userId"))
67-
self.assertEqual("Editor", organisation_users[2].get("role"))
66+
self.assertEqual(1967, organisation_users[1].get("userId"))
67+
self.assertEqual("Editor", organisation_users[1].get("role"))
6868

6969
def test_c_delete_organization_user_by_user_id(self):
70-
self.organisation.delete_organization_user_by_user_id(7)
70+
self.organisation.delete_organization_user_by_user_id(1967)
7171

7272
organisation_users: list = (
7373
self.organisation.get_all_users_by_the_current_organization()

0 commit comments

Comments
 (0)