Esempio n. 1
0
    def _create(self, options=None, data=None):
        kwdict = {"category": "test", "filename": "file", "extension": "ext"}
        if options is None:
            options = {}
        if data is not None:
            kwdict.update(data)

        self.pathfmt = util.PathFormat(self.extractor)
        self.pathfmt.set_directory(kwdict)
        self.pathfmt.set_filename(kwdict)

        pp = postprocessor.find(self.__class__.__name__[:-4].lower())
        return pp(self.pathfmt, options)
Esempio n. 2
0
    def _prepare_destination(cls, content=None, part=True, extension=None):
        name = "file-{}".format(cls.fnum)
        cls.fnum += 1

        kwdict = {
            "category": "test",
            "subcategory": "test",
            "filename": name,
            "extension": extension,
        }
        pathfmt = util.PathFormat(cls.extractor)
        pathfmt.set_directory(kwdict)
        pathfmt.set_filename(kwdict)

        if content:
            mode = "w" + ("b" if isinstance(content, bytes) else "")
            with pathfmt.open(mode) as file:
                file.write(content)

        return pathfmt
 def __init__(self):
     self.extractor = extractor.find("test:")
     self.pathfmt = util.PathFormat(self.extractor)
     self.out = output.NullOutput()
     self.get_logger = logging.getLogger
Esempio n. 4
0
 def __init__(self):
     self.extractor = extractor.find("test:")
     self.pathfmt = util.PathFormat(self.extractor)
     self.out = output.NullOutput()
     self.get_logger = logging.getLogger
     self.hooks = collections.defaultdict(list)