Skip to content

Commit

Permalink
Added test so that management command updated dimension fields
Browse files Browse the repository at this point in the history
  • Loading branch information
saulshanabrook committed Jun 4, 2013
1 parent 77904d6 commit f443c68
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
9 changes: 8 additions & 1 deletion simpleimages/test/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,14 @@ class TestModel(models.Model):
blank=True,
null=True,
editable=False,
upload_to='testing/thumbnails/'
upload_to='testing/thumbnails/',
width_field='thumbnail_width'
)

thumbnail_width = models.PositiveIntegerField(
null=True,
blank=True,
editable=False,
)

transformed_fields = {
Expand Down
8 changes: 8 additions & 0 deletions simpleimages/test/test_management_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,11 @@ def test_retransform_specific_field(self):
self.model_non_cached.thumbnail.width,
10,
)

def test_retransform_save_width_field(self):
call_command('retransform', 'test.TestModel.image')
self.model_non_cached = TestModel.objects.get(pk=self.model.pk)
self.assertEqual(
self.model_non_cached.thumbnail_width,
10,
)

0 comments on commit f443c68

Please sign in to comment.