SpiderFoot automates OSINT for threat intelligence and mapping your attack surface.
Python attacksurfacecticybersecurityfootprintinghackinginformation-gatheringinformation-securityinfosecintelligence-gatheringosintosint-frameworkosint-reconnaissanceosint-toolpentestingpythonreconsecurity-toolsthreat-intelligencethreatintel
sflib: SpiderFoot: remove handle argument from init
Brendan Coles86fc75a95c30
diff --git a/sflib.py b/sflib.pyindex e167d04e..64912380 100644--- a/sflib.py+++ b/sflib.py@@ -63,17 +63,15 @@ class SpiderFoot:savedsock = socketsocksProxy = None- def __init__(self, options, handle=None):+ def __init__(self, options):"""Initialize SpiderFoot object.Args:options (dict): dictionary of configuration options.- handle (str): a handle to something. will be supplied if the module- is being used within the SpiderFoot GUI, in which case all feedback- should be fed back"""+ if not isinstance(options, dict):+ raise TypeError("options is %s; expected dict()" % type(options))- self.handle = handleself.opts = deepcopy(options)# This is ugly but we don't want any fetches to fail - we expectdiff --git a/test/unit/test_spiderfoot.py b/test/unit/test_spiderfoot.pyindex 1b14dd5e..3e4194b7 100644--- a/test/unit/test_spiderfoot.py+++ b/test/unit/test_spiderfoot.py@@ -37,38 +37,26 @@ class TestSpiderFoot(unittest.TestCase):test_tlds = "// ===BEGIN ICANN DOMAINS===\n\ncom\nnet\norg\n\n// // ===END ICANN DOMAINS===\n"- @unittest.skip("todo")- def test_init_invalid_opts_should_raise(self):+ def test_init_argument_invalid_options_should_raise(self):"""- Test __init__(self, options, handle=None):+ Test __init__(self, options):"""- invalid_types = [None, "", list()]+ invalid_types = [None, "", list(), int()]for invalid_type in invalid_types:with self.subTest(invalid_type=invalid_type):with self.assertRaises(TypeError) as cm:sf = SpiderFoot(invalid_type)- @unittest.skip("todo")- def test_init_invalid_handle_should_raise(self):- """- Test __init__(self, options, handle=None):- """- invalid_types = [None, "", list(), dict()]- for invalid_type in invalid_types:- with self.subTest(invalid_type=invalid_type):- with self.assertRaises(TypeError) as cm:- sf = SpiderFoot(dict(), invalid_type)-def test_init_no_options(self):"""- Test __init__(self, options, handle=None):+ Test __init__(self, options):"""sf = SpiderFoot(dict())self.assertIsInstance(sf, SpiderFoot)def test_init(self):"""- Test __init__(self, options, handle=None):+ Test __init__(self, options):"""sf = SpiderFoot(self.default_options)self.assertIsInstance(sf, SpiderFoot)