Skip to content

Commit

Permalink
Remove unnecessary whitespace and format
Browse files Browse the repository at this point in the history
  • Loading branch information
mohamedelema17 authored Nov 11, 2024
1 parent 1d8f1b0 commit 0e2f910
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions tests/alerters/opsgenie_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -1268,18 +1268,23 @@ def test_formatted_opsgenie_addr(caplog):
'opsgenie_addr': 'https://api.opsgenie.com/v2/alerts/{alert_id}',
'type': mock_rule()
}
with mock.patch('requests.post') as mock_post:
with (mock.patch('requests.post') as mock_post):
rep = requests
rep.status_code = 202
url = rule.get('opsgenie_addr')
matches = [{'alert_id': '1234','@timestamp': '2014-10-31T00:00:00'}]
matches = [
{
'alert_id': '1234',
'@timestamp': '2014-10-31T00:00:00'
}
]
mock_post.return_value = rep
url.format(**matches[0])

alert = OpsGenieAlerter(rule)
alert.alert(matches)
mcal = mock_post._mock_call_args_list
assert mcal[0][0][0] == (f'https://api.opsgenie.com/v2/alerts/{matches[0].get("alert_id")}')
assert mcal[0][0][0] == f'https://api.opsgenie.com/v2/alerts/{matches[0].get("alert_id")}'
assert mock_post.called

assert mcal[0][1]['headers']['Authorization'] == 'GenieKey ogkey'
Expand Down

0 comments on commit 0e2f910

Please sign in to comment.