Ejemplo n.º 1
0
    def test_file_views(self, params, config, filedepot, dummy_request,
                        depot_tween):
        view, disposition = params
        self._create_file(config)

        res = view(self.file, dummy_request)

        self._test_common_headers(res.headers)

        assert res.content_disposition.startswith(
            '{0}; filename=my'.format(disposition))

        assert res.app_iter.file.read() == asset('logo.png').read()
        res.app_iter.file.seek(0)
        assert res.body == asset('logo.png').read()
Ejemplo n.º 2
0
    def test_file_views(self, params, config, filedepot, dummy_request,
                        depot_tween):
        view, disposition = params
        self._create_file(config)

        res = view(self.file, dummy_request)

        self._test_common_headers(res.headers)

        assert res.content_disposition.startswith(
            '{0}; filename=my'.format(disposition))

        assert res.app_iter.file.read() == asset('logo.png').read()
        res.app_iter.file.seek(0)
        assert res.body == asset('logo.png').read()
Ejemplo n.º 3
0
    def test_file_views(self, params, config, filedepot, dummy_request, depot_tween):
        view, disposition = params
        self._create_file(config)

        res = view(self.file, dummy_request)

        self._test_common_headers(res.headers)

        assert res.content_disposition.startswith(
            "{0}; filename=my".format(disposition)
        )

        data = asset("logo.png").read()
        assert res.body == data
        assert b"".join(res.app_iter) == data
Ejemplo n.º 4
0
 def _create_file(self, config):
     from kotti.resources import File
     self.file = File(asset('logo.png').read(), "myfüle.png", "image/png")
Ejemplo n.º 5
0
def cachetest_content(root, filedepot):
    image = asset('sendeschluss.jpg')
    root['textfile'] = File(b"file contents", 'mytext.txt', 'text/plain')
    root['image'] = File(image.read(), 'sendeschluss.jpg', 'image/jpeg')
Ejemplo n.º 6
0
    def _create_file(self, config):
        from kotti.resources import File

        self.file = File(asset("logo.png").read(), "myfüle.png", "image/png")
Ejemplo n.º 7
0
def cachetest_content(root, filedepot):
    image = asset('sendeschluss.jpg')
    root['textfile'] = File(b"file contents", 'mytext.txt', 'text/plain')
    root['image'] = File(image.read(), 'sendeschluss.jpg', 'image/jpeg')
Ejemplo n.º 8
0
def image_asset2():
    """ Return another image file """

    return testing.asset('logo.png')
Ejemplo n.º 9
0
def image_asset():
    """ Return an image file """

    return testing.asset('sendeschluss.jpg')
Ejemplo n.º 10
0
def cachetest_content(root, filedepot):
    image = asset('sendeschluss.jpg')
    root['textfile'] = File("file contents", u"mytext.txt", u"text/plain")
    root['image'] = Image(image.read(), u"sendeschluss.jpg", u"image/jpeg")
Ejemplo n.º 11
0
def image_asset2():
    """ Return another image file """

    return testing.asset("logo.png")
Ejemplo n.º 12
0
def image_asset():
    """ Return an image file """

    return testing.asset("sendeschluss.jpg")
Ejemplo n.º 13
0
 def _create_file(self, config):
     from kotti.resources import File
     self.file = File(asset('logo.png').read(), 'myfüle.png', 'image/png')
Ejemplo n.º 14
0
def cachetest_content(root, filedepot):
    image = asset('sendeschluss.jpg')
    root['textfile'] = File("file contents", u"mytext.txt", u"text/plain")
    root['image'] = Image(image.read(), u"sendeschluss.jpg", u"image/jpeg")
Ejemplo n.º 15
0
def cachetest_content(root, filedepot):
    image = asset("sendeschluss.jpg")
    root["textfile"] = File(b"file contents", "mytext.txt", "text/plain")
    root["image"] = File(image.read(), "sendeschluss.jpg", "image/jpeg")