示例#1
0
文件: test_file.py 项目: disko/Kotti
    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()
示例#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()
示例#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
示例#4
0
 def _create_file(self, config):
     from kotti.resources import File
     self.file = File(asset('logo.png').read(), "myfüle.png", "image/png")
示例#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')
示例#6
0
文件: test_file.py 项目: Kotti/Kotti
    def _create_file(self, config):
        from kotti.resources import File

        self.file = File(asset("logo.png").read(), "myfüle.png", "image/png")
示例#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')
示例#8
0
def image_asset2():
    """ Return another image file """

    return testing.asset('logo.png')
示例#9
0
def image_asset():
    """ Return an image file """

    return testing.asset('sendeschluss.jpg')
示例#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")
示例#11
0
def image_asset2():
    """ Return another image file """

    return testing.asset("logo.png")
示例#12
0
def image_asset():
    """ Return an image file """

    return testing.asset("sendeschluss.jpg")
示例#13
0
文件: test_file.py 项目: castaf/Kotti
 def _create_file(self, config):
     from kotti.resources import File
     self.file = File(asset('logo.png').read(), 'myfüle.png', 'image/png')
示例#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")
示例#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")