Skip to content

Commit

Permalink
Fixed #16645: fixed a broken test to work in Oracle.
Browse files Browse the repository at this point in the history
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16919 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information
nightflyerkilo committed Sep 30, 2011
1 parent bf05da8 commit 21a4491
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion tests/modeltests/model_forms/tests.py
Expand Up @@ -8,6 +8,7 @@
from django.test import TestCase
from django.core.files.uploadedfile import SimpleUploadedFile
from django.core.validators import ValidationError
from django.db import connection
from django.forms.models import model_to_dict
from django.utils.unittest import skipUnless

Expand Down Expand Up @@ -1313,11 +1314,17 @@ def test_image_field(self):
instance.delete()

# Test the non-required ImageField
# Note: In Oracle, we expect a null ImageField to return u'' instead of
# None.
if connection.features.interprets_empty_strings_as_nulls:
expected_null_imagefield_repr = u''
else:
expected_null_imagefield_repr = None

f = OptionalImageFileForm(data={'description': u'Test'})
self.assertEqual(f.is_valid(), True)
instance = f.save()
self.assertEqual(instance.image.name, None)
self.assertEqual(instance.image.name, expected_null_imagefield_repr)
self.assertEqual(instance.width, None)
self.assertEqual(instance.height, None)

Expand Down

0 comments on commit 21a4491

Please sign in to comment.