Author: ramiro Date: 2011-10-16 20:29:07 -0700 (Sun, 16 Oct 2011) New Revision: 17002
Modified: django/trunk/tests/modeltests/fixtures/fixtures/invalid.json django/trunk/tests/modeltests/fixtures/tests.py Log: Tweaked test added in r16873 so it also works with Oracle. * Changed invalid fixture from trying to insert a NULL value in a null=False CharField to try with a DateTimeField instead because our Oracle backend allows NULLs for CharFields than can be blank and that insert wouldn't generate an error. * cx_Oracle raises a `DatabaseError: Could not load fixtures.Article(pk=1): ORA-01407: cannot update ("USER_DEFAULT"."FIXTURES_ARTICLE"."PUB_DATE") to NULL'` instead of an IntegrityError like the rest of the DB-API drivers we support, changed the error message we test for to start simply with 'Error' to catch both messages. We might want to consider converting DatabaseError to IntegrityError in the backend when the error code is ORA-1407. Modified: django/trunk/tests/modeltests/fixtures/fixtures/invalid.json =================================================================== --- django/trunk/tests/modeltests/fixtures/fixtures/invalid.json 2011-10-17 02:11:12 UTC (rev 17001) +++ django/trunk/tests/modeltests/fixtures/fixtures/invalid.json 2011-10-17 03:29:07 UTC (rev 17002) @@ -3,8 +3,8 @@ "pk": "1", "model": "fixtures.article", "fields": { - "headline": null, - "pub_date": "2006-06-16 13:00:00" + "headline": "Breaking news", + "pub_date": null } } ] Modified: django/trunk/tests/modeltests/fixtures/tests.py =================================================================== --- django/trunk/tests/modeltests/fixtures/tests.py 2011-10-17 02:11:12 UTC (rev 17001) +++ django/trunk/tests/modeltests/fixtures/tests.py 2011-10-17 03:29:07 UTC (rev 17002) @@ -269,7 +269,7 @@ new_io = StringIO.StringIO() management.call_command('loaddata', 'invalid.json', verbosity=0, stderr=new_io, commit=False) output = new_io.getvalue().strip().split('\n') - self.assertRegexpMatches(output[-1], "IntegrityError: Could not load fixtures.Article\(pk=1\): .*$") + self.assertRegexpMatches(output[-1], "Error: Could not load fixtures.Article\(pk=1\): .*$") def test_loading_using(self): # Load db fixtures 1 and 2. These will load using the 'default' database identifier explicitly -- You received this message because you are subscribed to the Google Groups "Django updates" group. To post to this group, send email to django-updates@googlegroups.com. To unsubscribe from this group, send email to django-updates+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-updates?hl=en.