From 61d11a1a53dd9f3ec29c71562ebb2c13db308418 Mon Sep 17 00:00:00 2001 From: Andrew Krasichkov Date: Wed, 17 May 2017 00:38:33 +0300 Subject: [PATCH] Adjust tests to the new formatters logic --- tests/plugins/test_simply.py | 9 ++++----- tests/utils.py | 5 ----- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/tests/plugins/test_simply.py b/tests/plugins/test_simply.py index f8da9e3..1a33c63 100644 --- a/tests/plugins/test_simply.py +++ b/tests/plugins/test_simply.py @@ -4,7 +4,6 @@ import os from os import path import json -import gixy from ..utils import * from gixy.core.manager import Manager as Gixy 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) with yoda_provider(plugin, plugin_options) as yoda: 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') result = results[0] @@ -104,7 +105,5 @@ def check_configuration(plugin, config_path, test_config): def check_configuration_fp(plugin, config_path, test_config): with yoda_provider(plugin) as yoda: yoda.audit(config_path, open(config_path, mode='r')) - results = RawFormatter().format(yoda) - - assert_equals(len(results), 0, + assert_equals(len([x for x in yoda.results]), 0, 'False positive configuration must not trigger any plugins') diff --git a/tests/utils.py b/tests/utils.py index c542b99..6d1494d 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -62,8 +62,3 @@ class Matcher(object): else: result = dv.find(v) >= 0 return result - - -class RawFormatter(BaseFormatter): - def format_reports(self, reports, stats): - return reports