Esempio n. 1
0
    def check_all(self, zipcontents):
        try: 
            zipfile = io.BytesIO(zipcontents)
            zip_data = iocollect.extract_zip(zipfile) # contents of output zipfile produced by `python zipout.py` as a dict
        except:
            logging.error("Could not process zip file")
            return None

        # check if references has subdirectories
        try:
            ref_subdirs = iocollect.getdirs(os.path.abspath(self.ref_dir))
        except:
            logging.error("Internal Error: Could not find references.")
            return None

        if len(ref_subdirs) > 0:
            for subdir in ref_subdirs:
                try:
                    files = iocollect.getfiles(os.path.abspath(os.path.join(self.ref_dir, subdir)))
                except:
                    logging.error("Internal Error: Could not find references.")
                    return None
                self.check_path(subdir, files, zip_data)
        else:
            try:
                files = iocollect.getfiles(os.path.abspath(self.ref_dir))
            except:
                logging.error("Internal Error: Could not find references.")
                return None
            self.check_path(None, files, zip_data)

        if len(self.perf.keys()) == 0:
            return None

        return self.perf
Esempio n. 2
0
    def check_all(self, zipcontents):
        zipfile = io.BytesIO(zipcontents)
        zip_data = iocollect.extract_zip(zipfile) # contents of output zipfile produced by `python zipout.py` as a dict

        # check if references has subdirectories
        ref_subdirs = iocollect.getdirs(os.path.abspath(self.ref_dir))
        if len(ref_subdirs) > 0:
            for subdir in ref_subdirs:
                files = iocollect.getfiles(os.path.abspath(os.path.join(self.ref_dir, subdir)))
                self.check_path(subdir, files, zip_data)
        else:
            files = iocollect.getfiles(os.path.abspath(self.ref_dir))
            self.check_path(None, files, zip_data)
        return self.perf
Esempio n. 3
0
    def check_all(self, zipcontents):
        zipfile = io.BytesIO(zipcontents)
        zip_data = iocollect.extract_zip(zipfile) # contents of output zipfile produced by `python zipout.py` as a dict

        # check if references has subdirectories
        ref_subdirs = iocollect.getdirs(os.path.abspath(self.ref_dir))
        if len(ref_subdirs) > 0:
            for subdir in ref_subdirs:
                files = iocollect.getfiles(os.path.abspath(os.path.join(self.ref_dir, subdir)))
                self.check_path(subdir, files, zip_data)
        else:
            files = iocollect.getfiles(os.path.abspath(self.ref_dir))
            self.check_path(None, files, zip_data)
        return self.perf