~ubuntu-branches/ubuntu/quantal/python-django/quantal-security

« back to all changes in this revision

Viewing changes to tests/regressiontests/bug8245/tests.py

  • Committer: Bazaar Package Importer
  • Author(s): Chris Lamb
  • Date: 2010-05-21 07:52:55 UTC
  • mfrom: (1.3.6 upstream)
  • mto: This revision was merged to the branch mainline in revision 28.
  • Revision ID: james.westby@ubuntu.com-20100521075255-ii78v1dyfmyu3uzx
Tags: upstream-1.2
ImportĀ upstreamĀ versionĀ 1.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
8
8
    Test for bug #8245 - don't raise an AlreadyRegistered exception when using
9
9
    autodiscover() and an admin.py module contains an error.
10
10
    """
11
 
 
12
11
    def test_bug_8245(self):
13
12
        # The first time autodiscover is called, we should get our real error.
14
13
        try:
18
17
        else:
19
18
            self.fail(
20
19
                'autodiscover should have raised a "Bad admin module" error.')
21
 
        # Calling autodiscover again should bail out early and not raise an
22
 
        # AlreadyRegistered error.
23
 
        admin.autodiscover()
 
20
 
 
21
        # Calling autodiscover again should raise the very same error it did
 
22
        # the first time, not an AlreadyRegistered error.
 
23
        try:
 
24
            admin.autodiscover()
 
25
        except Exception, e:
 
26
            self.failUnlessEqual(str(e), "Bad admin module")
 
27
        else:
 
28
            self.fail(
 
29
                'autodiscover should have raised a "Bad admin module" error.')