Example #1
0
 def test_delete_all_alerts_for_fails_with_wrong_input(self):
     instance = AlertManager('APIKey')
     with self.assertRaises(AssertionError):
         instance.delete_all_alerts_for(None)
     with self.assertRaises(AssertionError):
         self._trigger.id = 123
         instance.delete_all_alerts_for(self._trigger)
Example #2
0
 def test_get_alert_fails_with_wrong_input(self):
     instance = AlertManager('APIKey')
     with self.assertRaises(AssertionError):
         instance.get_alert(None, self._trigger)
     with self.assertRaises(AssertionError):
         instance.get_alert(123, self._trigger)
     with self.assertRaises(AssertionError):
         instance.get_alert('alert-id', None)
     with self.assertRaises(AssertionError):
         self._trigger.id = 123
         instance.get_alert('alert-id', self._trigger)
Example #3
0
 def test_delete_alert_fails_with_wrong_input(self):
     instance = AlertManager('APIKey')
     with self.assertRaises(AssertionError):
         instance.delete_alert(None)
     with self.assertRaises(AssertionError):
         self._alert.id = 123
         instance.delete_alert(self._alert)
     self._alert.id = 'alert-id'
     self._alert.trigger_id = None
     with self.assertRaises(AssertionError):
         instance.delete_alert(self._alert)
     self._alert.trigger_id = 789
     with self.assertRaises(AssertionError):
         instance.delete_alert(self._alert)
Example #4
0
 def test_get_alert_fails_with_wrong_input(self):
     instance = AlertManager('APIKey')
     with self.assertRaises(AssertionError):
         instance.get_alert(None, self._trigger)
     with self.assertRaises(AssertionError):
         instance.get_alert(123, self._trigger)
     with self.assertRaises(AssertionError):
         instance.get_alert('alert-id', None)
     with self.assertRaises(AssertionError):
         self._trigger.id = 123
         instance.get_alert('alert-id', self._trigger)
Example #5
0
 def test_delete_alert_fails_with_wrong_input(self):
     instance = AlertManager('APIKey')
     with self.assertRaises(AssertionError):
         instance.delete_alert(None)
     with self.assertRaises(AssertionError):
         self._alert.id = 123
         instance.delete_alert(self._alert)
     self._alert.id = 'alert-id'
     self._alert.trigger_id = None
     with self.assertRaises(AssertionError):
         instance.delete_alert(self._alert)
     self._alert.trigger_id = 789
     with self.assertRaises(AssertionError):
         instance.delete_alert(self._alert)
Example #6
0
 def test_delete_all_alerts_for_fails_with_wrong_input(self):
     instance = AlertManager('APIKey')
     with self.assertRaises(AssertionError):
         instance.delete_all_alerts_for(None)
     with self.assertRaises(AssertionError):
         self._trigger.id = 123
         instance.delete_all_alerts_for(self._trigger)
 def test_get_alerts_for_fails_with_wrong_input(self):
     instance = AlertManager('APIKey', DEFAULT_CONFIG)
     with self.assertRaises(AssertionError):
         instance.get_alerts_for(None)
     with self.assertRaises(AssertionError):
         self._trigger.id = 123
         instance.get_alerts_for(self._trigger)
Example #8
0
 def test_get_trigger_fails_with_wrong_input(self):
     instance = AlertManager('APIKey')
     with self.assertRaises(AssertionError):
         instance.get_trigger(None)
     with self.assertRaises(AssertionError):
         instance.get_trigger(123)
Example #9
0
 def test_get_alert_api_version(self):
     instance = AlertManager('APIKey')
     result = instance.alert_api_version()
     self.assertIsInstance(result, tuple)
     self.assertEqual(result, ALERT_API_VERSION)
Example #10
0
 def factory(self, _kls):
     sm = AlertManager('APIKey')
     sm.http_client = _kls()
     return sm
Example #11
0
 def test_get_trigger_fails_with_wrong_input(self):
     instance = AlertManager('APIKey')
     with self.assertRaises(AssertionError):
         instance.get_trigger(None)
     with self.assertRaises(AssertionError):
         instance.get_trigger(123)
Example #12
0
 def test_get_alert_api_version(self):
     instance = AlertManager('APIKey')
     result = instance.alert_api_version()
     self.assertIsInstance(result, tuple)
     self.assertEqual(result, ALERT_API_VERSION)
Example #13
0
 def factory(self, _kls):
     sm = AlertManager('APIKey')
     sm.http_client = _kls()
     return sm
 def test_repr(self):
     print(AlertManager('APIKey', DEFAULT_CONFIG))
 def factory(self, _kls):
     sm = AlertManager('APIKey', DEFAULT_CONFIG)
     sm.http_client = _kls('APIKey', DEFAULT_CONFIG, 'anyurl.com')
     return sm