@@ -223,13 +223,41 @@ def test_get_all_contact_points(self, call_the_api_mock):
223223 grafana_api_model = model
224224 )
225225
226- call_the_api_mock .return_value = list ([{"test" : "test" }])
226+ call_the_api_mock .return_value = list ([{"test" : "test" }, { "specific-contact-point" : "specific contact point" } ])
227227
228228 self .assertEqual (
229- list ([{"test" : "test" }]),
229+ list ([{"test" : "test" }, { "specific-contact-point" : "specific contact point" } ]),
230230 alerting_provisioning .get_all_contact_points (),
231231 )
232232
233+ @patch ("grafana_api.api.Api.call_the_api" )
234+ def test_get_specific_contact_points (self , call_the_api_mock ):
235+ model : APIModel = APIModel (host = MagicMock (), token = MagicMock ())
236+ alerting_provisioning : AlertingProvisioning = AlertingProvisioning (
237+ grafana_api_model = model
238+ )
239+
240+ call_the_api_mock .return_value = list ([{"specific-contact-point" : "specific contact point" }])
241+
242+ self .assertEqual (
243+ list ([{"specific-contact-point" : "specific contact point" }]),
244+ alerting_provisioning .get_contact_point ("specific-contact-point" ),
245+ )
246+
247+ @patch ("grafana_api.api.Api.call_the_api" )
248+ def test_get_specific_contact_points_empty_on_partial_name_should_return_empty_list (self , call_the_api_mock ):
249+ model : APIModel = APIModel (host = MagicMock (), token = MagicMock ())
250+ alerting_provisioning : AlertingProvisioning = AlertingProvisioning (
251+ grafana_api_model = model
252+ )
253+
254+ call_the_api_mock .return_value = list ([])
255+
256+ self .assertEqual (
257+ list ([]),
258+ alerting_provisioning .get_contact_point ("contact-point-invalid-name" ),
259+ )
260+
233261 @patch ("grafana_api.api.Api.call_the_api" )
234262 def test_get_all_contact_points_not_possible (self , call_the_api_mock ):
235263 model : APIModel = APIModel (host = MagicMock (), token = MagicMock ())
0 commit comments