def test_scanErrors_argument_instanceId_of_invalid_type_should_raise_TypeError(self):
        """
        Test scanErrors(self, instanceId, limit=None)
        """
        sfdb = SpiderFootDb(self.default_options, False)

        limit = 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.scanErrors(invalid_type, limit)
Beispiel #2
0
 def test_scan_errors(self):
     """
     Test scanErrors(self, instanceId, limit=None)
     """
     sfdb = SpiderFootDb(self.default_options, False)
     scan_instance = sfdb.scanErrors(None, None)
     self.assertIsInstance(scan_instance, list)
 def test_scanErrors_should_return_a_list(self):
     """
     Test scanErrors(self, instanceId, limit=None)
     """
     sfdb = SpiderFootDb(self.default_options, False)
     instance_id = "example instance id"
     scan_instance = sfdb.scanErrors(instance_id, None)
     self.assertIsInstance(scan_instance, list)
Beispiel #4
0
 def scanerrors(self, id, limit=None):
     dbh = SpiderFootDb(self.config)
     data = dbh.scanErrors(id, limit)
     retdata = []
     for row in data:
         generated = time.strftime("%Y-%m-%d %H:%M:%S",
                                   time.localtime(row[0] / 1000))
         retdata.append([generated, row[1], html.escape(str(row[2]))])
     return json.dumps(retdata)
 def scanerrors(self, id, limit=None):
     dbh = SpiderFootDb(self.config)
     data = dbh.scanErrors(id, limit)
     retdata = []
     for row in data:
         generated = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(row[0] / 1000))
         retdata.append([generated, row[1],
                         cgi.escape(unicode(row[2], errors='replace'))])
     return json.dumps(retdata)
Beispiel #6
0
    def scanerrors(self, id, limit=None):
        """Scan error data

        Args:
            id (str): scan ID
            limit: TBD
        """

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

        try:
            data = dbh.scanErrors(id, limit)
        except Exception:
            return json.dumps(retdata)

        for row in data:
            generated = time.strftime("%Y-%m-%d %H:%M:%S",
                                      time.localtime(row[0] / 1000))
            retdata.append([generated, row[1], html.escape(str(row[2]))])

        return json.dumps(retdata)