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

« back to all changes in this revision

Viewing changes to django/contrib/sites/tests.py

  • Committer: Bazaar Package Importer
  • Author(s): Chris Lamb
  • Date: 2009-07-29 11:26:28 UTC
  • mfrom: (1.2.3 upstream)
  • mto: This revision was merged to the branch mainline in revision 22.
  • Revision ID: james.westby@ubuntu.com-20090729112628-9qrzwnl9x32jxhbg
Tags: upstream-1.1
ImportĀ upstreamĀ versionĀ 1.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
>>> from django.conf import settings
4
4
>>> Site(id=settings.SITE_ID, domain="example.com", name="example.com").save()
5
5
 
6
 
>>> # Make sure that get_current() does not return a deleted Site object.
 
6
# Make sure that get_current() does not return a deleted Site object.
7
7
>>> s = Site.objects.get_current()
8
8
>>> isinstance(s, Site)
9
9
True
13
13
Traceback (most recent call last):
14
14
...
15
15
DoesNotExist: Site matching query does not exist.
 
16
 
 
17
# After updating a Site object (e.g. via the admin), we shouldn't return a
 
18
# bogus value from the SITE_CACHE.
 
19
>>> _ = Site.objects.create(id=settings.SITE_ID, domain="example.com", name="example.com")
 
20
>>> site = Site.objects.get_current()
 
21
>>> site.name
 
22
u"example.com"
 
23
>>> s2 = Site.objects.get(id=settings.SITE_ID)
 
24
>>> s2.name = "Example site"
 
25
>>> s2.save()
 
26
>>> site = Site.objects.get_current()
 
27
>>> site.name
 
28
u"Example site"
16
29
"""