mirror of
https://github.com/django/django.git
synced 2025-07-05 10:19:20 +00:00
[soc2010/test-refactor] updated fixtures tests to use @skipIfDBEngine() decorator
git-svn-id: http://code.djangoproject.com/svn/django/branches/soc2010/test-refactor@13417 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
e0bd235ffa
commit
cee4afc267
@ -1,10 +1,9 @@
|
|||||||
import StringIO
|
import StringIO
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
from django.test import TestCase, TransactionTestCase
|
from django.test import TestCase, TransactionTestCase, skipIfDBEngine
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.core import management
|
from django.core import management
|
||||||
from django.db import DEFAULT_DB_ALIAS
|
|
||||||
|
|
||||||
from models import Article, Blog, Book, Category, Person, Tag, Visa
|
from models import Article, Blog, Book, Category, Person, Tag, Visa
|
||||||
|
|
||||||
@ -22,7 +21,6 @@ class TestCaseFixtureLoadingTests(TestCase):
|
|||||||
])
|
])
|
||||||
|
|
||||||
class FixtureLoadingTests(TestCase):
|
class FixtureLoadingTests(TestCase):
|
||||||
|
|
||||||
def _dumpdata_assert(self, args, output, format='json', natural_keys=False):
|
def _dumpdata_assert(self, args, output, format='json', natural_keys=False):
|
||||||
new_io = StringIO.StringIO()
|
new_io = StringIO.StringIO()
|
||||||
management.call_command('dumpdata', *args, **{'format':format, 'stdout':new_io, 'use_natural_keys':natural_keys})
|
management.call_command('dumpdata', *args, **{'format':format, 'stdout':new_io, 'use_natural_keys':natural_keys})
|
||||||
@ -232,8 +230,8 @@ class FixtureLoadingTests(TestCase):
|
|||||||
self._dumpdata_assert(['fixtures'], """<?xml version="1.0" encoding="utf-8"?>
|
self._dumpdata_assert(['fixtures'], """<?xml version="1.0" encoding="utf-8"?>
|
||||||
<django-objects version="1.0"><object pk="1" model="fixtures.category"><field type="CharField" name="title">News Stories</field><field type="TextField" name="description">Latest news stories</field></object><object pk="3" model="fixtures.article"><field type="CharField" name="headline">Time to reform copyright</field><field type="DateTimeField" name="pub_date">2006-06-16 13:00:00</field></object><object pk="2" model="fixtures.article"><field type="CharField" name="headline">Poker has no place on ESPN</field><field type="DateTimeField" name="pub_date">2006-06-16 12:00:00</field></object><object pk="1" model="fixtures.article"><field type="CharField" name="headline">Python program becomes self aware</field><field type="DateTimeField" name="pub_date">2006-06-16 11:00:00</field></object><object pk="1" model="fixtures.tag"><field type="CharField" name="name">copyright</field><field to="contenttypes.contenttype" name="tagged_type" rel="ManyToOneRel"><natural>fixtures</natural><natural>article</natural></field><field type="PositiveIntegerField" name="tagged_id">3</field></object><object pk="2" model="fixtures.tag"><field type="CharField" name="name">law</field><field to="contenttypes.contenttype" name="tagged_type" rel="ManyToOneRel"><natural>fixtures</natural><natural>article</natural></field><field type="PositiveIntegerField" name="tagged_id">3</field></object><object pk="1" model="fixtures.person"><field type="CharField" name="name">Django Reinhardt</field></object><object pk="3" model="fixtures.person"><field type="CharField" name="name">Prince</field></object><object pk="2" model="fixtures.person"><field type="CharField" name="name">Stephane Grappelli</field></object></django-objects>""", format='xml', natural_keys=True)
|
<django-objects version="1.0"><object pk="1" model="fixtures.category"><field type="CharField" name="title">News Stories</field><field type="TextField" name="description">Latest news stories</field></object><object pk="3" model="fixtures.article"><field type="CharField" name="headline">Time to reform copyright</field><field type="DateTimeField" name="pub_date">2006-06-16 13:00:00</field></object><object pk="2" model="fixtures.article"><field type="CharField" name="headline">Poker has no place on ESPN</field><field type="DateTimeField" name="pub_date">2006-06-16 12:00:00</field></object><object pk="1" model="fixtures.article"><field type="CharField" name="headline">Python program becomes self aware</field><field type="DateTimeField" name="pub_date">2006-06-16 11:00:00</field></object><object pk="1" model="fixtures.tag"><field type="CharField" name="name">copyright</field><field to="contenttypes.contenttype" name="tagged_type" rel="ManyToOneRel"><natural>fixtures</natural><natural>article</natural></field><field type="PositiveIntegerField" name="tagged_id">3</field></object><object pk="2" model="fixtures.tag"><field type="CharField" name="name">law</field><field to="contenttypes.contenttype" name="tagged_type" rel="ManyToOneRel"><natural>fixtures</natural><natural>article</natural></field><field type="PositiveIntegerField" name="tagged_id">3</field></object><object pk="1" model="fixtures.person"><field type="CharField" name="name">Django Reinhardt</field></object><object pk="3" model="fixtures.person"><field type="CharField" name="name">Prince</field></object><object pk="2" model="fixtures.person"><field type="CharField" name="name">Stephane Grappelli</field></object></django-objects>""", format='xml', natural_keys=True)
|
||||||
|
|
||||||
if settings.DATABASES[DEFAULT_DB_ALIAS]['ENGINE'] != 'django.db.backends.mysql':
|
@skipIfDBEngine('django.db.backends.mysql')
|
||||||
class FixtureTransactionTests(TransactionTestCase):
|
class FixtureTransactionTests(TransactionTestCase):
|
||||||
def _dumpdata_assert(self, args, output, format='json'):
|
def _dumpdata_assert(self, args, output, format='json'):
|
||||||
new_io = StringIO.StringIO()
|
new_io = StringIO.StringIO()
|
||||||
management.call_command('dumpdata', *args, **{'format':format, 'stdout':new_io})
|
management.call_command('dumpdata', *args, **{'format':format, 'stdout':new_io})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user