Update alert test case with master

Signed-off-by: Brandon Myers <bmyers@mozilla.com>
This commit is contained in:
Brandon Myers 2016-10-21 18:33:09 -05:00
Родитель 731da67eba
Коммит 0b5efec854
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 8AA79AD83045BBC7
3 изменённых файлов: 15 добавлений и 15 удалений

Просмотреть файл

@ -16,11 +16,11 @@ class AlertTestCase(object):
self.expected_alert = expected_alert
self.full_events = []
def run(self, alert_src, alert_name):
def run(self, alert_filename, alert_classname):
print '\n\tTesting {} '.format(self.description),
alert_file_module = __import__(alert_src)
alert_class = getattr(alert_file_module, alert_name)
alert_file_module = __import__(alert_filename)
alert_class_attr = getattr(alert_file_module, alert_classname)
alert_task = alert_class()
alert_task = alert_class_attr()
alert_task.run()
return alert_task

Просмотреть файл

@ -20,17 +20,18 @@ class AlertTestSuite(UnitTestSuite):
self.alert_classname = (self.__class__.__name__[4:] if
self.__class__.__name__.startswith('Test') else
False)
# Convert "AlertFooBar" to "foo_bar" and "BazQux" to "baz_qux"
self.alert_filename = re.sub(
'([a-z0-9])([A-Z])',
r'\1_\2',
re.sub(
'(.)([A-Z][a-z]+)',
r'\1_\2',
self.alert_classname[5:] if
self.alert_classname.startswith('Alert') else
self.alert_classname)).lower()
if not self.alert_filename:
# Convert "AlertFooBar" to "foo_bar" and "BazQux" to "baz_qux"
self.alert_filename = re.sub(
'([a-z0-9])([A-Z])',
r'\1_\2',
re.sub(
'(.)([A-Z][a-z]+)',
r'\1_\2',
self.alert_classname[5:] if
self.alert_classname.startswith('Alert') else
self.alert_classname)).lower()
# Some housekeeping stuff here to make sure the data we get is 'good'
def verify_starting_values(self, test_case):

Просмотреть файл

@ -14,7 +14,6 @@ from dateutil.parser import parse
class UnitTestSuite(object):
def setup(self):
print "Setting up unit test suite"
self.index_name = datetime.now().strftime("events-%Y%m%d")
# todo: remove once we are able to run unit tests against