Fix get_or_create test failure under Oracle
Test expected that when given invalid utf-8, the backend should raise a DatabaseError, but the Oracle backend raises a UnicodeDecodeError.
This commit is contained in:
parent
31f6421b13
commit
cf159e5c93
|
@ -5,6 +5,7 @@ import traceback
|
||||||
import warnings
|
import warnings
|
||||||
|
|
||||||
from django.db import IntegrityError, DatabaseError
|
from django.db import IntegrityError, DatabaseError
|
||||||
|
from django.utils.encoding import DjangoUnicodeDecodeError
|
||||||
from django.test import TestCase, TransactionTestCase
|
from django.test import TestCase, TransactionTestCase
|
||||||
|
|
||||||
from .models import Person, ManualPrimaryKeyTest, Profile, Tag, Thing
|
from .models import Person, ManualPrimaryKeyTest, Profile, Tag, Thing
|
||||||
|
@ -76,7 +77,7 @@ class GetOrCreateTests(TestCase):
|
||||||
Person.objects.get_or_create(
|
Person.objects.get_or_create(
|
||||||
birthday=date(1970, 1, 1),
|
birthday=date(1970, 1, 1),
|
||||||
defaults={'first_name': "\xff", 'last_name': "\xff"})
|
defaults={'first_name': "\xff", 'last_name': "\xff"})
|
||||||
except DatabaseError:
|
except (DatabaseError, DjangoUnicodeDecodeError):
|
||||||
Person.objects.create(
|
Person.objects.create(
|
||||||
first_name="Bob", last_name="Ross", birthday=date(1950, 1, 1))
|
first_name="Bob", last_name="Ross", birthday=date(1950, 1, 1))
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in New Issue