From ad6a92a8adaaac786421746224033fc34cd989d1 Mon Sep 17 00:00:00 2001 From: Jake Hunsaker Date: Mon, 12 Jul 2021 11:28:58 -0400 Subject: [cleaner] Read map file only once for parsers Instead of re-reading the mapping file for each parser, read it once and store the contents, then hand those contents over to each parser. This allows us to side-step handling the same exception for malformed config files over and over for each parser loaded. Signed-off-by: Jake Hunsaker --- tests/unittests/cleaner_tests.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'tests') diff --git a/tests/unittests/cleaner_tests.py b/tests/unittests/cleaner_tests.py index 5510dd80..cb20772f 100644 --- a/tests/unittests/cleaner_tests.py +++ b/tests/unittests/cleaner_tests.py @@ -100,11 +100,11 @@ class CleanerMapTests(unittest.TestCase): class CleanerParserTests(unittest.TestCase): def setUp(self): - self.ip_parser = SoSIPParser() - self.mac_parser = SoSMacParser() - self.host_parser = SoSHostnameParser(opt_domains='foobar.com') - self.kw_parser = SoSKeywordParser(keywords=['foobar']) - self.kw_parser_none = SoSKeywordParser() + self.ip_parser = SoSIPParser(config={}) + self.mac_parser = SoSMacParser(config={}) + self.host_parser = SoSHostnameParser(config={}, opt_domains='foobar.com') + self.kw_parser = SoSKeywordParser(config={}, keywords=['foobar']) + self.kw_parser_none = SoSKeywordParser(config={}) def test_ip_parser_valid_ipv4_line(self): line = 'foobar foo 10.0.0.1/24 barfoo bar' -- cgit