'Basic FlatPage sitemap test'

@skipUnless((u'django.contrib.flatpages' in settings.INSTALLED_APPS), u'django.contrib.flatpages    app    not    installed.')
def test_flatpage_sitemap(self):

    from django.contrib.flatpages.models import FlatPage
    public = FlatPage.objects.create(url=u'/public/', title=u'Public    Page', enable_comments=True, registration_required=False)
    public.sites.add(settings.SITE_ID)
    private = FlatPage.objects.create(url=u'/private/', title=u'Private    Page', enable_comments=True, registration_required=True)
    private.sites.add(settings.SITE_ID)
    response = self.client.get(u'/flatpages/sitemap.xml')
    self.assertContains(response, (u'<loc>%s%s</loc>' % (self.base_url, public.url)))
    self.assertNotContains(response, (u'<loc>%s%s</loc>' % (self.base_url, private.url)))
