[py3k] IDownloadable.download_data() returns bytes
authorRémi Cardona <remi.cardona@logilab.fr>
Tue, 22 Sep 2015 15:31:44 +0200
changeset 10731 0736e31f8644
parent 10730 874ac29b515d
child 10732 6231587fcfc5
[py3k] IDownloadable.download_data() returns bytes
entities/adapters.py
web/test/unittest_idownloadable.py
--- a/entities/adapters.py	Tue Sep 22 15:24:58 2015 +0200
+++ b/entities/adapters.py	Tue Sep 22 15:31:44 2015 +0200
@@ -187,7 +187,7 @@
         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
--- a/web/test/unittest_idownloadable.py	Tue Sep 22 15:24:58 2015 +0200
+++ b/web/test/unittest_idownloadable.py	Tue Sep 22 15:31:44 2015 +0200
@@ -42,7 +42,7 @@
         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 @@
                              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 @@
                              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 @@
                              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: