Ticket #4371: fixtures_test.diff
File fixtures_test.diff, 1.3 KB (added by , 17 years ago) |
---|
-
models.py
75 75 # Dump the current contents of the database as a JSON fixture 76 76 >>> management.call_command('dumpdata', 'fixtures', format='json') 77 77 [{"pk": "3", "model": "fixtures.article", "fields": {"headline": "Time to reform copyright", "pub_date": "2006-06-16 13:00:00"}}, {"pk": "2", "model": "fixtures.article", "fields": {"headline": "Poker has no place on ESPN", "pub_date": "2006-06-16 12:00:00"}}, {"pk": "1", "model": "fixtures.article", "fields": {"headline": "Python program becomes self aware", "pub_date": "2006-06-16 11:00:00"}}] 78 79 # redirect stderr for the next few tests... 80 >>> import sys 81 >>> savestderr = sys.stderr 82 >>> sys.stderr = sys.stdout 83 84 # Loading data of an unknown format should fail 85 >>> management.call_command('loaddata', 'bad_fixture1.unkn', verbosity=0) 86 Problem installing fixture 'bad_fixture1': unkn is not a known serialization format. 87 88 # Loading a fixture file with invalid data 89 >>> management.call_command('loaddata', 'bad_fixture2.xml', verbosity=0) 90 Empty fixture file 'bad_fixture2' found. (File format may be invalid.) 91 92 >>> sys.stderr = savestderr 78 93 """} 79 94 80 95 from django.test import TestCase