Example #1
0
    def test_handleEvent(self):
        """
        Test handleEvent(self, event)
        """
        sf = SpiderFoot(self.default_options)

        module = sfp_iban()
        module.setup(sf, dict())

        target_value = 'example target value'
        target_type = 'IP_ADDRESS'
        target = SpiderFootTarget(target_value, target_type)
        module.setTarget(target)

        event_type = 'ROOT'
        event_data = 'example data'
        event_module = 'sfp_test_module'
        source_event = ''
        source_event = SpiderFootEvent(event_type, event_data, event_module,
                                       source_event)

        event_type = 'TARGET_WEB_CONTENT'
        event_data = 'example data'
        event_module = 'sfp_test_module'
        evt = SpiderFootEvent(event_type, event_data, event_module,
                              source_event)

        result = module.handleEvent(evt)
        self.assertIsNone(result)

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

        self.assertIsNone(result)
Example #2
0
    def test_handleEvent_event_data_not_containing_iban_string_should_not_return_event(
            self):
        sf = SpiderFoot(self.default_options)

        module = sfp_iban()
        module.setup(sf, dict())

        target_value = 'spiderfoot.net'
        target_type = 'INTERNET_NAME'
        target = SpiderFootTarget(target_value, target_type)
        module.setTarget(target)

        def new_notifyListeners(self, event):
            raise Exception(f"Raised event {event.eventType}: {event.data}")

        module.notifyListeners = new_notifyListeners.__get__(module, sfp_iban)

        event_type = 'ROOT'
        event_data = 'example data'
        event_module = ''
        source_event = ''

        evt = SpiderFootEvent(event_type, event_data, event_module,
                              source_event)
        result = module.handleEvent(evt)

        self.assertIsNone(result)
Example #3
0
    def test_handleEvent_event_data_containing_iban_string_should_return_event(
            self):
        sf = SpiderFoot(self.default_options)

        module = sfp_iban()
        module.setup(sf, dict())

        target_value = 'spiderfoot.net'
        target_type = 'INTERNET_NAME'
        target = SpiderFootTarget(target_value, target_type)
        module.setTarget(target)

        def new_notifyListeners(self, event):
            expected = 'IBAN_NUMBER'
            if str(event.eventType) != expected:
                raise Exception(f"{event.eventType} != {expected}")

            expected = 'BE71096123456769'
            if str(event.data) != expected:
                raise Exception(f"{event.data} != {expected}")

        module.notifyListeners = new_notifyListeners.__get__(module, sfp_iban)

        event_type = 'ROOT'
        event_data = 'BE71096123456769'
        event_module = ''
        source_event = ''

        evt = SpiderFootEvent(event_type, event_data, event_module,
                              source_event)
        result = module.handleEvent(evt)

        self.assertIsNone(result)
Example #4
0
    def test_setup(self):
        """
        Test setup(self, sfc, userOpts=dict())
        """
        sf = SpiderFoot(self.default_options)

        module = sfp_iban()
        module.setup(sf, dict())
Example #5
0
    def test_handleEvent(self):
        """
        Test handleEvent(self, event)
        """
        sf = SpiderFoot(self.default_options)

        module = sfp_iban()
        module.setup(sf, dict())

        target_value = 'example target value'
        target_type = 'IP_ADDRESS'
        target = SpiderFootTarget(target_value, target_type)
        module.setTarget(target)

        event_type = 'ROOT'
        event_data = ''
        event_module = ''
        source_event = ''
        evt = SpiderFootEvent(event_type, event_data, event_module, source_event)

        result = module.handleEvent(evt)
Example #6
0
 def test_producedEvents_should_return_list(self):
     module = sfp_iban()
     self.assertIsInstance(module.producedEvents(), list)
Example #7
0
 def test_opts(self):
     module = sfp_iban()
     self.assertEqual(len(module.opts), len(module.optdescs))
Example #8
0
 def test_setup(self):
     sf = SpiderFoot(self.default_options)
     module = sfp_iban()
     module.setup(sf, dict())