def test_scanResultEventUnique_argument_instanceId_of_invalid_type_should_raise_TypeError(self):
        """
        Test scanResultEventUnique(self, instanceId, eventType='ALL', filterFp=False)
        """
        sfdb = SpiderFootDb(self.default_options, False)

        event_type = 'ALL'
        filter_fp = None

        invalid_types = [None, list(), dict(), int()]
        for invalid_type in invalid_types:
            with self.subTest(invalid_type=invalid_type):
                with self.assertRaises(TypeError) as cm:
                    sfdb.scanResultEventUnique(invalid_type, event_type, filter_fp)
Beispiel #2
0
 def test_scan_result_event_unique_should_return_a_list(self):
     """
     Test scanResultEventUnique(self, instanceId, eventType='ALL', filterFp=False)
     """
     sfdb = SpiderFootDb(self.default_options, False)
     scan_result_event = sfdb.scanResultEventUnique("", "", False)
     self.assertIsInstance(scan_result_event, list)
Beispiel #3
0
 def scaneventresultsunique(self, id, eventType, filterfp=False):
     dbh = SpiderFootDb(self.config)
     data = dbh.scanResultEventUnique(id, eventType, filterfp)
     retdata = []
     for row in data:
         escaped = cgi.escape(row[0])
         retdata.append([escaped, row[1], row[2]])
     return json.dumps(retdata, ensure_ascii=False)
 def scaneventresultsunique(self, id, eventType, filterfp=False):
     dbh = SpiderFootDb(self.config)
     data = dbh.scanResultEventUnique(id, eventType, filterfp)
     retdata = []
     for row in data:
         escaped = cgi.escape(row[0])
         retdata.append([escaped, row[1], row[2]])
     return json.dumps(retdata, ensure_ascii=False)
Beispiel #5
0
    def test_scan_result_event_unique_invalid_event_type_should_raise(self):
        """
        Test scanResultEventUnique(self, instanceId, eventType='ALL', filterFp=False)
        """
        sfdb = SpiderFootDb(self.default_options, False)

        invalid_types = [None, list(), dict()]
        for invalid_type in invalid_types:
            with self.subTest(invalid_type=invalid_type):
                with self.assertRaises(TypeError) as cm:
                    scan_result_event = sfdb.scanResultEventUnique(
                        "", invalid_type, None)
    def test_configSet_argument_optmap_of_invalid_type_should_raise_TypeError(self):
        """
        Test configSet(self, optMap=dict())
        """
        sfdb = SpiderFootDb(self.default_options, False)

        invalid_types = [None, "", list()]
        for invalid_type in invalid_types:
            with self.subTest(invalid_type=invalid_type):
                with self.assertRaises(TypeError) as cm:
                    scan_result_event = sfdb.scanResultEventUnique("", invalid_type, None)
                    sfdb.configSet(invalid_type)
Beispiel #7
0
    def scaneventresultsunique(self, id, eventType, filterfp=False):
        """Unique event results for a scan

        Args:
            id (str): scan ID
            eventType (str): filter by event type
            filterfp: TBD
        """

        dbh = SpiderFootDb(self.config)
        retdata = []

        try:
            data = dbh.scanResultEventUnique(id, eventType, filterfp)
        except Exception:
            return json.dumps(retdata)

        for row in data:
            escaped = html.escape(row[0])
            retdata.append([escaped, row[1], row[2]])
        return json.dumps(retdata, ensure_ascii=False)