Skip to content

Commit

Permalink
style: run pre-commit
Browse files Browse the repository at this point in the history
  • Loading branch information
sbgap committed Jun 11, 2024
1 parent 2197b79 commit bf4af39
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion tests/test_notification_rule.py
Original file line number Diff line number Diff line change
Expand Up @@ -1002,4 +1002,4 @@ def test_advanced_severity(self):
self.assertIn(notification_rule, active_notification_rules)
self.assertIn(to_critical_major_from_all_rule, active_notification_rules)
self.assertNotIn(to_normal_from_critical_major_rule, active_notification_rules)
self.assertIn(simple_rule, active_notification_rules)
self.assertIn(simple_rule, active_notification_rules)
9 changes: 4 additions & 5 deletions tests/test_notification_rule_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import unittest
from datetime import datetime, timedelta


from alerta.app import create_app, db, plugins
from alerta.models.key import ApiKey

Expand Down Expand Up @@ -57,7 +56,7 @@ def setUp(self) -> None:
scopes=['admin', 'read', 'write'],
text='demo-key',
)
self.admin_api_key.create()
self.admin_api_key.create()

self.headers = {
'Authorization': f'Key {self.admin_api_key.key}',
Expand All @@ -76,7 +75,7 @@ def get_api_obj(self, apiurl: str, apiheaders: dict, status_code: int = 200) ->
def create_api_obj(self, apiurl: str, apidata: dict, apiheaders: dict, status_code: int = 201) -> dict:
response = self.client.post(apiurl, data=json.dumps(apidata), headers=apiheaders)
self.assertEqual(response.status_code, status_code)
return json.loads(response.data.decode('utf-8'))
return json.loads(response.data.decode('utf-8'))

def test_delayed_notifications(self):
notification_rule = {
Expand Down Expand Up @@ -120,7 +119,7 @@ def test_delayed_notifications(self):
delayed_data = self.get_api_obj('/notificationdelay/fire', self.headers)
self.assertTrue(datetime.now() - start >= timedelta(seconds=1))
self.assertIn({'rule_id': delayed_notification_rule_id, 'alert_id': alert_id}, map(get_delay_id, delayed_data['notifications']))

def test_twilio_sms_channel(self):
try:
twilio_config = {
Expand Down Expand Up @@ -211,4 +210,4 @@ def test_sendgrid_channel(self):
{'rule_id': notification_rule_id, 'alert_id': alert_id},
map(get_history_id, history)
)
self.assertTrue(history[0]['sent'])
self.assertTrue(history[0]['sent'])

0 comments on commit bf4af39

Please sign in to comment.