mirror of
https://github.com/django/django.git
synced 2025-07-05 10:19:20 +00:00
[soc2010/test-refactor] updated custom_pk modeltest to take advantage of unittest2
git-svn-id: http://code.djangoproject.com/svn/django/branches/soc2010/test-refactor@13412 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
e87ead6d08
commit
62e587418c
@ -1,6 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from django.test import TestCase
|
||||
|
||||
from django.utils.unittest import skipIf
|
||||
from django.conf import settings
|
||||
from django.db import transaction, IntegrityError, DEFAULT_DB_ALIAS
|
||||
|
||||
@ -116,10 +116,10 @@ class CustomPkTestCase(TestCase):
|
||||
# SQLite lets objects be saved with an empty primary key, even though an
|
||||
# integer is expected. So we can't check for an error being raised in that case
|
||||
# for SQLite. Remove it from the suite for this next bit.
|
||||
@skipIf(settings.DATABASES[DEFAULT_DB_ALIAS]['ENGINE'] == 'django.db.backends.sqlite3',
|
||||
"SQLite lets objects be saved with empty pk")
|
||||
def test_empty_pk_error(self):
|
||||
#fixme, improve this skiping with unittest2
|
||||
if settings.DATABASES[DEFAULT_DB_ALIAS]['ENGINE'] != 'django.db.backends.sqlite3':
|
||||
self.assertRaises(IntegrityError,
|
||||
Employee.objects.create,
|
||||
first_name='Tom', last_name='Smith')
|
||||
self.assertRaises(IntegrityError,
|
||||
Employee.objects.create,
|
||||
first_name='Tom', last_name='Smith')
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user