Permalink
Browse files

Update alert test suite to handle notify_mozdefbot correctly

  • Loading branch information...
pwnbus committed Nov 28, 2018
1 parent 3b1194b commit 3be81b07b517eb4a1f39acfda42ec51b9a418a23
Showing with 4 additions and 4 deletions.
  1. +4 −4 tests/alerts/alert_test_suite.py
@@ -195,15 +195,15 @@ def verify_expected_alert(self, found_alert, test_case):
# Verify there is a utctimestamp field
assert 'utctimestamp' in found_alert['_source'], 'Alert does not have utctimestamp specified'

if 'ircchannel' not in test_case.expected_alert:
test_case.expected_alert['ircchannel'] = None

# Verify notify_mozdefbot is set correctly based on severity
expected_notify_mozdefbot = True
if test_case.expected_alert['severity'] == 'NOTICE' or test_case.expected_alert['severity'] == 'INFO':
if (test_case.expected_alert['severity'] == 'NOTICE' or test_case.expected_alert['severity'] == 'INFO') and test_case.expected_alert['ircchannel'] is None:
expected_notify_mozdefbot = False
test_case.expected_alert['notify_mozdefbot'] = expected_notify_mozdefbot

if 'ircchannel' not in test_case.expected_alert:
test_case.expected_alert['ircchannel'] = None

# Verify ircchannel is set correctly
assert found_alert['_source']['ircchannel'] == test_case.expected_alert['ircchannel'], 'Alert ircchannel field is bad'

0 comments on commit 3be81b0

Please sign in to comment.