コード例 #1
0
    def test_scanEventStore_argument_sfEvent_with_empty_confidence_property_value_should_raise_ValueError(
            self):
        """
        Test scanEventStore(self, instanceId, sfEvent, truncateSize=0)
        """
        sfdb = SpiderFootDb(self.default_options, False)

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

        event_type = 'example event type'
        event_data = 'example event data'
        module = 'example module'
        event = SpiderFootEvent(event_type, event_data, module, source_event)

        instance_id = "example instance id"
        invalid_values = [-1, 101]
        for invalid_value in invalid_values:
            with self.subTest(invalid_value=invalid_value):
                with self.assertRaises(ValueError):
                    event = SpiderFootEvent(event_type, event_data, module,
                                            source_event)
                    event.confidence = invalid_value
                    sfdb.scanEventStore(instance_id, event)
コード例 #2
0
    def test_confidence_attribute_should_return_confidence_as_integer(self):
        event_type = 'ROOT'
        event_data = 'example event data'
        module = ''
        source_event = ''
        confidence = 100

        evt = SpiderFootEvent(event_type, event_data, module, source_event)
        evt.confidence = confidence

        self.assertEqual(confidence, evt.confidence)
コード例 #3
0
    def test_confidence_attribute_setter_invalid_type_should_raise_TypeError(
            self):
        event_type = 'ROOT'
        event_data = 'example event data'
        module = ''
        source_event = ''
        evt = SpiderFootEvent(event_type, event_data, module, source_event)

        invalid_types = [None, "", list(), dict()]
        for invalid_type in invalid_types:
            with self.subTest(invalid_type=invalid_type):
                with self.assertRaises(TypeError):
                    evt.confidence = invalid_type
コード例 #4
0
    def test_init_argument_confidence_invalid_value_should_raise_ValueError(
            self):
        event_type = 'ROOT'
        event_data = 'example event data'
        module = ''
        source_event = ''

        invalid_values = [-1, 101]
        for invalid_value in invalid_values:
            with self.subTest(invalid_value=invalid_value):
                with self.assertRaises(ValueError):
                    evt = SpiderFootEvent(event_type, event_data, module,
                                          source_event)
                    evt.confidence = invalid_value