Exemplo n.º 1
0
 def test_calls_save_images_when_resizing_works(self):
     images = object()
     init(
         self.db, self.Storage,
         flexmock(sizes={
             'nail': (38, 12),
         }, resize_image=lambda x: images))
     save(StringIO(u'bauercontent'), u'jackfile')
     assert self.save_images_args == (u'jackfile', u'bauercontent', images)
Exemplo n.º 2
0
    def test_calls_save_file_when_resizing_raises_ioerror(self):
        def raise_ioerror(*args, **kwargs):
            raise IOError

        init(self.db, self.Storage,
             flexmock(
                 sizes={'nail': (23, 49)},
                 resize_image=raise_ioerror,
             ))
        save(StringIO(u'bauercontent'), u'jackfile')
        assert self.save_file_args == (u'jackfile', u'bauercontent')
 def test_calls_save_file_when_resizing_raises_ioerror(self):
     def raise_ioerror(*args, **kwargs):
         raise IOError
     init(
         self.db,
         self.Storage,
         flexmock(
             sizes={'nail': (23, 49)},
             resize_image=raise_ioerror,
         )
     )
     save(StringIO(u'bauercontent'), u'jackfile')
     assert self.save_file_args == (u'jackfile', u'bauercontent')
 def test_calls_save_images_when_resizing_works(self):
     images = object()
     init(
         self.db,
         self.Storage,
         flexmock(
             sizes={
                 'nail': (38, 12),
             },
             resize_image=lambda x: images
         )
     )
     save(StringIO(u'bauercontent'), u'jackfile')
     assert self.save_images_args == (u'jackfile', u'bauercontent', images)
Exemplo n.º 5
0
 def test_calls_save_file_without_resizer(self):
     init(self.db, self.Storage)
     save(StringIO(u'bauercontent'), u'jackfile')
     assert self.save_file_args == (u'jackfile', u'bauercontent')
 def test_calls_save_file_without_resizer(self):
     init(self.db, self.Storage)
     save(StringIO(u'bauercontent'), u'jackfile')
     assert self.save_file_args == (u'jackfile', u'bauercontent')
Exemplo n.º 7
0
 def setup_method(self, method, resizer=None):
     init(db_mock, MockStorage, resizer)
     self.db = db_mock
     self.Storage = MockStorage
     self.storage = MockStorage()
     self.resizer = resizer