Add Django-1.2.1
[frozenviper.git] / Django-1.2.1 / django / contrib / sites / tests.py
blobe3fa81b9d11a5f480a6f6e94d16e04732c7f9dae
1 """
2 >>> from django.contrib.sites.models import Site
3 >>> from django.conf import settings
4 >>> Site(id=settings.SITE_ID, domain="example.com", name="example.com").save()
6 # Make sure that get_current() does not return a deleted Site object.
7 >>> s = Site.objects.get_current()
8 >>> isinstance(s, Site)
9 True
11 >>> s.delete()
12 >>> Site.objects.get_current()
13 Traceback (most recent call last):
14 ...
15 DoesNotExist: Site matching query does not exist.
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"
29 """