def test_to_dict(self): source = self._get_test_file('sample.png') thumbs = dict(small=(100, 100)) Image.set_sizes(thumbs=thumbs) image = Image(source=source, name="original.png", session=self.session) self.session.commit() d = image.to_dict() self.assertIn('small_url', d) self.assertIn('small_width', d) self.assertIn('width', d) self.assertIn('height', d) self.assertIn('small_height', d) d1 = image.to_dict(paths=True) self.assertIn('path', d1) self.assertIn('small_path', d1)