Permalink
Browse files

Update alert test suite to use tests config file

  • Loading branch information...
pwnbus committed Sep 7, 2018
1 parent 7d2affb commit 106101a5d071fa62d8ca6c9bb9d2d09b706e1e6c
Showing with 20 additions and 0 deletions.
  1. +18 −0 tests/alerts/alert_test_suite.py
  2. +2 −0 tests/suite_helper.py
@@ -18,6 +18,9 @@
import re
import json
sys.path.append(os.path.join(os.path.dirname(__file__), "../../alerts/lib"))
from lib import alerttask
class AlertTestSuite(UnitTestSuite):
def teardown(self):
@@ -27,6 +30,21 @@ def setup(self):
self.orig_path = os.getcwd()
super(AlertTestSuite, self).setup()
# Overwrite the ES and RABBITMQ configs for alerts
# since it pulls it from alerts/lib/config.py
alerttask.ES = {
'servers': list('{0}'.format(s) for s in self.options.esservers)
}
alerttask.RABBITMQ = {
'mquser': self.options.mquser,
'alertexchange': self.options.alertExchange,
'alertqueue': self.options.alertqueue,
'mqport': self.options.mqport,
'mqserver': self.options.mqserver,
'mqpassword': self.options.mqpassword,
'mqalertserver': self.options.mqalertserver
}
alerts_dir = os.path.join(os.path.dirname(__file__), "../../alerts/")
os.chdir(alerts_dir)
View
@@ -36,10 +36,12 @@ def parse_config_file():
options.alertExchange = getConfig('alertexchange', 'alerts', options.configfile)
options.queueName = getConfig('alertqueuename', 'alertBot', options.configfile)
options.alertqueue = getConfig('alertqueue', 'mozdef.alert', options.configfile)
options.alerttopic = getConfig('alerttopic', 'mozdef.*', options.configfile)
options.mquser = getConfig('mquser', 'guest', options.configfile)
options.mqalertserver = getConfig('mqalertserver', 'localhost', options.configfile)
options.mqserver = getConfig('mqserver', 'localhost', options.configfile)
options.mqpassword = getConfig('mqpassword', 'guest', options.configfile)
options.mqport = getConfig('mqport', 5672, options.configfile)
options.mqack = getConfig('mqack', True, options.configfile)

0 comments on commit 106101a

Please sign in to comment.