def test_checkForStop(self): """ Test checkForStop(self) """ sfp = SpiderFootPlugin() class DatabaseStub: def scanInstanceGet(self, scanId): return [None, None, None, None, None, status] sfp.__sfdb__ = DatabaseStub() sfp.__scanId__ = 'example scan id' # pseudo-parameterized test scan_statuses = [(None, False), ("anything", False), ("RUNNING", False), ("ABORT-REQUESTED", True)] for status, expectedReturnValue in scan_statuses: returnValue = sfp.checkForStop() self.assertEqual(returnValue, expectedReturnValue, status)
def test_checkForStop(self): """ Test checkForStop(self) Todo: include other statuses for completeness """ sfp = SpiderFootPlugin() class DatabaseStub: def scanInstanceGet(self, scanId): return [None, None, None, None, None, status] sfp.__sfdb__ = DatabaseStub() sfp.__scanId__ = 'example scan id' # pseudo-parameterized test for status, expectedReturnValue in [("RUNNING", False), ("ABORT-REQUESTED", True)]: returnValue = sfp.checkForStop() self.assertEqual(returnValue, expectedReturnValue, status)
def test_notifyListeners(self): """ Test notifyListeners(self, sfEvent) Todo: Test with source event """ sfp = SpiderFootPlugin() class DatabaseStub: def scanInstanceGet(self, scanId): return [None, None, None, None, None, None] sfp.__sfdb__ = DatabaseStub() event_type = 'ROOT' event_data = 'test data' module = 'test module' source_event = None evt = SpiderFootEvent(event_type, event_data, module, source_event) sfp.notifyListeners(evt) self.assertEqual('TBD', 'TBD')