'Check that published titles are in the urls'

def test_sitemap_published_titles(self):

    sitemap = CMSSitemap()
    locations = []
    urlset = sitemap.get_urls()
    for item in urlset:
        locations.append(item['location'])
    for title in Title.objects.public():
        page = title.page.get_public_object()
        if title.path:
            url = ('http://example.com/%s/%s/' % (title.language, title.path))
        else:
            url = ('http://example.com/%s/%s' % (title.language, title.path))
        if (page.is_published('en') and (not page.publisher_is_draft)):
            self.assertTrue((url in locations))
        else:
            self.assertFalse((url in locations))
