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()
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
def _create_file(self, config): from kotti.resources import File self.file = File(asset('logo.png').read(), "myfüle.png", "image/png")
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')
def _create_file(self, config): from kotti.resources import File self.file = File(asset("logo.png").read(), "myfüle.png", "image/png")
def image_asset2(): """ Return another image file """ return testing.asset('logo.png')
def image_asset(): """ Return an image file """ return testing.asset('sendeschluss.jpg')
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")
def image_asset2(): """ Return another image file """ return testing.asset("logo.png")
def image_asset(): """ Return an image file """ return testing.asset("sendeschluss.jpg")
def _create_file(self, config): from kotti.resources import File self.file = File(asset('logo.png').read(), 'myfüle.png', 'image/png')
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")