Exemplo n.º 1
0
    def test_loads_image_from_result_storage(self):
        self.context.request = Mock(accepts_webp=False)
        expected_path = self.result_storage.normalize_path("P_leK0uires4J3AXg5RkKfSWH4A=/animated_image.gif")
        os.makedirs(dirname(expected_path))
        with open(expected_path, "w") as img:
            img.write(animated_image())

        response = self.fetch("/P_leK0uires4J3AXg5RkKfSWH4A=/animated_image.gif")
        expect(response.code).to_equal(200)
        expect(response.body).to_be_similar_to(animated_image())
Exemplo n.º 2
0
    def test_loads_image_from_result_storage(self):
        self.context.request = Mock(accepts_webp=False, )
        expected_path = self.result_storage.normalize_path(
            'gTr2Xr9lbzIa2CT_dL_O0GByeR0=/animated.gif')
        os.makedirs(dirname(expected_path))
        with open(expected_path, 'w') as img:
            img.write(animated_image())

        response = self.fetch('/gTr2Xr9lbzIa2CT_dL_O0GByeR0=/animated.gif')
        expect(response.code).to_equal(200)
        expect(response.body).to_be_similar_to(animated_image())
Exemplo n.º 3
0
    def test_loads_image_from_result_storage(self):
        self.context.request = Mock(
            accepts_webp=False,
        )
        expected_path = self.result_storage.normalize_path('gTr2Xr9lbzIa2CT_dL_O0GByeR0=/animated.gif')
        os.makedirs(dirname(expected_path))
        with open(expected_path, 'w') as img:
            img.write(animated_image())

        response = self.fetch('/gTr2Xr9lbzIa2CT_dL_O0GByeR0=/animated.gif')
        expect(response.code).to_equal(200)
        expect(response.body).to_be_similar_to(animated_image())
Exemplo n.º 4
0
    def test_loads_image_from_result_storage(self):
        self.context.request = Mock(
            accepts_webp=False,
        )
        expected_path = self.result_storage.normalize_path('P_leK0uires4J3AXg5RkKfSWH4A=/animated_image.gif')
        os.makedirs(dirname(expected_path))
        with open(expected_path, 'w') as img:
            img.write(animated_image())

        response = self.fetch('/P_leK0uires4J3AXg5RkKfSWH4A=/animated_image.gif')
        expect(response.code).to_equal(200)
        expect(response.body).to_be_similar_to(animated_image())
Exemplo n.º 5
0
    def test_saves_image_to_result_storage(self, instance_mock):
        instance_mock.return_value = self.io_loop
        response = self.fetch("/P_leK0uires4J3AXg5RkKfSWH4A=/animated_image.gif")
        expect(response.code).to_equal(200)

        self.context.request = Mock(accepts_webp=False)
        expected_path = self.result_storage.normalize_path("P_leK0uires4J3AXg5RkKfSWH4A=/animated_image.gif")
        expect(expected_path).to_exist()
        expect(response.body).to_be_similar_to(animated_image())
Exemplo n.º 6
0
    def test_saves_image_to_result_storage(self, instance_mock):
        instance_mock.return_value = self.io_loop
        response = self.fetch('/gTr2Xr9lbzIa2CT_dL_O0GByeR0=/animated.gif')
        expect(response.code).to_equal(200)

        self.context.request = Mock(accepts_webp=False, )
        expected_path = self.result_storage.normalize_path(
            'gTr2Xr9lbzIa2CT_dL_O0GByeR0=/animated.gif')
        expect(expected_path).to_exist()
        expect(response.body).to_be_similar_to(animated_image())
Exemplo n.º 7
0
    def test_saves_image_to_result_storage(self, instance_mock):
        instance_mock.return_value = self.io_loop
        response = self.fetch('/gTr2Xr9lbzIa2CT_dL_O0GByeR0=/animated.gif')
        expect(response.code).to_equal(200)

        self.context.request = Mock(
            accepts_webp=False,
        )
        expected_path = self.result_storage.normalize_path('gTr2Xr9lbzIa2CT_dL_O0GByeR0=/animated.gif')
        expect(expected_path).to_exist()
        expect(response.body).to_be_similar_to(animated_image())
Exemplo n.º 8
0
    def test_saves_image_to_result_storage(self, instance_mock):
        instance_mock.return_value = self.io_loop
        response = self.fetch('/P_leK0uires4J3AXg5RkKfSWH4A=/animated_image.gif')
        expect(response.code).to_equal(200)

        self.context.request = Mock(
            accepts_webp=False,
        )
        expected_path = self.result_storage.normalize_path('P_leK0uires4J3AXg5RkKfSWH4A=/animated_image.gif')
        expect(expected_path).to_exist()
        expect(response.body).to_be_similar_to(animated_image())