diff options
| author | Russell Keith-Magee <russell@keith-magee.com> | 2007-08-17 15:05:54 +0000 |
|---|---|---|
| committer | Russell Keith-Magee <russell@keith-magee.com> | 2007-08-17 15:05:54 +0000 |
| commit | fcec755f01cfaba2a85bfc9511876debbce98631 (patch) | |
| tree | e990effbcd90e4d405b0f9dcc70cb38e47b6f3dc /django/test/testcases.py | |
| parent | 0f92ac52cbf81fb2ac01755c558e2e6ad54700e8 (diff) | |
newforms-admin: Merged from trunk up to [5916]
git-svn-id: http://code.djangoproject.com/svn/django/branches/newforms-admin@5918 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/test/testcases.py')
| -rw-r--r-- | django/test/testcases.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/django/test/testcases.py b/django/test/testcases.py index 5373d822df..21c429271c 100644 --- a/django/test/testcases.py +++ b/django/test/testcases.py @@ -1,7 +1,8 @@ import re, unittest from urlparse import urlparse from django.db import transaction -from django.core import management, mail +from django.core import mail +from django.core.management import call_command from django.db.models import get_apps from django.test import _doctest as doctest from django.test.client import Client @@ -42,9 +43,11 @@ class TestCase(unittest.TestCase): * Clearing the mail test outbox. """ - management.flush(verbosity=0, interactive=False) + call_command('flush', verbosity=0, interactive=False) if hasattr(self, 'fixtures'): - management.load_data(self.fixtures, verbosity=0) + # We have to use this slightly awkward syntax due to the fact + # that we're using *args and **kwargs together. + call_command('loaddata', *self.fixtures, **{'verbosity': 0}) mail.outbox = [] def __call__(self, result=None): @@ -88,7 +91,7 @@ class TestCase(unittest.TestCase): self.assertEqual(real_count, count, "Found %d instances of '%s' in response (expected %d)" % (real_count, text, count)) else: - self.assertTrue(real_count != 0, "Couldn't find '%s' in response" % text) + self.failUnless(real_count != 0, "Couldn't find '%s' in response" % text) def assertFormError(self, response, form, field, errors): "Assert that a form used to render the response has a specific field error" |
