Adjust tests to the new formatters logic

pull/47/head
Andrew Krasichkov 2017-05-17 00:38:33 +03:00
parent fc994816d4
commit 61d11a1a53
2 changed files with 4 additions and 10 deletions

View File

@ -4,7 +4,6 @@ import os
from os import path from os import path
import json import json
import gixy
from ..utils import * from ..utils import *
from gixy.core.manager import Manager as Gixy from gixy.core.manager import Manager as Gixy
from gixy.core.plugins_manager import PluginsManager from gixy.core.plugins_manager import PluginsManager
@ -83,7 +82,9 @@ def check_configuration(plugin, config_path, test_config):
plugin_options = parse_plugin_options(config_path) plugin_options = parse_plugin_options(config_path)
with yoda_provider(plugin, plugin_options) as yoda: with yoda_provider(plugin, plugin_options) as yoda:
yoda.audit(config_path, open(config_path, mode='r')) yoda.audit(config_path, open(config_path, mode='r'))
results = RawFormatter().format(yoda) formatter = BaseFormatter()
formatter.feed(config_path, yoda)
_, results = formatter.reports.popitem()
assert_equals(len(results), 1, 'Should have one report') assert_equals(len(results), 1, 'Should have one report')
result = results[0] result = results[0]
@ -104,7 +105,5 @@ def check_configuration(plugin, config_path, test_config):
def check_configuration_fp(plugin, config_path, test_config): def check_configuration_fp(plugin, config_path, test_config):
with yoda_provider(plugin) as yoda: with yoda_provider(plugin) as yoda:
yoda.audit(config_path, open(config_path, mode='r')) yoda.audit(config_path, open(config_path, mode='r'))
results = RawFormatter().format(yoda) assert_equals(len([x for x in yoda.results]), 0,
assert_equals(len(results), 0,
'False positive configuration must not trigger any plugins') 'False positive configuration must not trigger any plugins')

View File

@ -62,8 +62,3 @@ class Matcher(object):
else: else:
result = dv.find(v) >= 0 result = dv.find(v) >= 0
return result return result
class RawFormatter(BaseFormatter):
def format_reports(self, reports, stats):
return reports