def test_get_gallery(self): """if we add a gallery to the site, we should see both the gallery and the photo in the sitemap.""" self.gallery = helpers._create_new_gallery( name='Fake Gallery', slug='fake-gallery') response = self.client.get('/sitemap.xml') today = datetime.date.today().strftime('%Y-%m-%d') photo_string = '<url><loc>http://example.com/photologue/photo/landscape/</loc><lastmod>{today}</lastmod><priority>0.5</priority></url>'\ .format(today=today) self.assertContains(response, photo_string) gallery_string = '<url><loc>http://example.com/photologue/gallery/fake-gallery/</loc><lastmod>{today}</lastmod><priority>0.5</priority></url>'\ .format(today=today) self.assertContains(response, gallery_string) self.gallery.delete()
def setUp(self): super(RequestGalleryTest, self).setUp() self.gallery = helpers._create_new_gallery( name='Fake Gallery', slug='fake-gallery')