Пример #1
0
    def _image_fetcher(self) -> ImageFetcher:
        image_fetcher = ImageFetcher()

        ImageFetcher.get_internal_path = Mock()
        ImageFetcher.get_internal_path.return_value = self.path

        ImageFetcher.get_resolution_path = Mock()
        ImageFetcher.get_resolution_path.return_value = self.resized_path

        ImageFetcher.resize_image = Mock()

        return image_fetcher
Пример #2
0
    def _image_fetcher(self) -> ImageFetcher:
        image_fetcher = ImageFetcher()

        ImageFetcher.fetch_image = Mock()

        image = Image.new('RGB', (1, 1))
        image.save(f"/{self.filename}")

        ImageFetcher.fetch_image.return_value = Image.open(f"/{self.filename}")

        yield image_fetcher

        os.remove(f"/{self.filename}")
Пример #3
0
def _image_fetcher() -> ImageFetcher:
    image_fetcher = ImageFetcher()
    return image_fetcher