Ejemplo n.º 1
0
    def test_check_for_stop(self):
        """
        Test checkForStop(self)
        """
        sfp = SpiderFootPlugin()

        class DatabaseStub:
            def scanInstanceGet(self, scanId):
                return [None, None, None, None, None, status]

        sfp.__sfdb__ = DatabaseStub()

        # pseudo-parameterized test
        # TODO could include other statuses for completeness
        for status, expectedReturnValue in [("RUNNING", False),
                                            ("ABORT-REQUESTED", True)]:
            returnValue = sfp.checkForStop()
            self.assertEqual(returnValue, expectedReturnValue, status)
Ejemplo n.º 2
0
    def test_notify_listeners(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 #SpiderFootEvent("ROOT", '', '', "ROOT")
        evt = SpiderFootEvent(event_type, event_data, module, source_event)
        sfp.notifyListeners(evt)

        self.assertEqual('TBD', 'TBD')