Commit 2c2cd78c authored by Rémi Cardona's avatar Rémi Cardona
Browse files

[py3k] IDownloadable.download_data() returns bytes

parent 874ac29b515d
......@@ -187,7 +187,7 @@ class IDownloadableAdapter(view.EntityAdapter):
raise NotImplementedError
def download_data(self):
"""return actual data of the downloadable content"""
"""return actual data (bytes) of the downloadable content"""
raise NotImplementedError
# XXX should propose to use two different relations for children/parent
......
......@@ -42,7 +42,7 @@ class IDownloadableUser(view.EntityAdapter):
return self.entity.name() + '.txt'
def download_data(self):
return 'Babar is not dead!'
return b'Babar is not dead!'
class BrokenIDownloadableGroup(IDownloadableUser):
......@@ -72,7 +72,7 @@ class IDownloadableTC(CubicWebTC):
get('content-disposition'))
self.assertEqual(['text/plain;charset=ascii'],
get('content-type'))
self.assertEqual('Babar is not dead!', data)
self.assertEqual(b'Babar is not dead!', data)
def test_header_with_space(self):
with self.admin_access.web_request() as req:
......@@ -87,7 +87,7 @@ class IDownloadableTC(CubicWebTC):
get('content-disposition'))
self.assertEqual(['text/plain;charset=ascii'],
get('content-type'))
self.assertEqual('Babar is not dead!', data)
self.assertEqual(b'Babar is not dead!', data)
def test_header_with_space_and_comma(self):
with self.admin_access.web_request() as req:
......@@ -102,7 +102,7 @@ class IDownloadableTC(CubicWebTC):
get('content-disposition'))
self.assertEqual(['text/plain;charset=ascii'],
get('content-type'))
self.assertEqual('Babar is not dead!', data)
self.assertEqual(b'Babar is not dead!', data)
def test_header_unicode_filename(self):
with self.admin_access.web_request() as req:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment