def test_zinnia_statistics(self): with self.assertNumQueries(9): context = zinnia_statistics() self.assertEquals(context['template'], 'zinnia/tags/statistics.html') self.assertEquals(context['entries'], 0) self.assertEquals(context['categories'], 0) self.assertEquals(context['tags'], 0) self.assertEquals(context['authors'], 0) self.assertEquals(context['comments'], 0) self.assertEquals(context['pingbacks'], 0) self.assertEquals(context['trackbacks'], 0) self.assertEquals(context['rejects'], 0) self.assertEquals(context['words_per_entry'], 0) self.assertEquals(context['words_per_comment'], 0) self.assertEquals(context['entries_per_month'], 0) self.assertEquals(context['comments_per_entry'], 0) self.assertEquals(context['linkbacks_per_entry'], 0) site = Site.objects.get_current() Category.objects.create(title='Category 1', slug='category-1') author = Author.objects.create_user(username='******', email='*****@*****.**') comments.get_model().objects.create(comment='My Comment 1', site=site, content_object=self.entry, submit_date=timezone.now()) self.entry.authors.add(author) self.publish_entry() with self.assertNumQueries(13): context = zinnia_statistics('custom_template.html') self.assertEquals(context['template'], 'custom_template.html') self.assertEquals(context['entries'], 1) self.assertEquals(context['categories'], 1) self.assertEquals(context['tags'], 2) self.assertEquals(context['authors'], 1) self.assertEquals(context['comments'], 1) self.assertEquals(context['pingbacks'], 0) self.assertEquals(context['trackbacks'], 0) self.assertEquals(context['rejects'], 0) self.assertEquals(context['words_per_entry'], 2) self.assertEquals(context['words_per_comment'], 3) self.assertEquals(context['entries_per_month'], 1) self.assertEquals(context['comments_per_entry'], 1) self.assertEquals(context['linkbacks_per_entry'], 0)
def test_zinnia_statistics(self): with self.assertNumQueries(9): context = zinnia_statistics() self.assertEquals(context['template'], 'zinnia/tags/statistics.html') self.assertEquals(context['entries'], 0) self.assertEquals(context['categories'], 0) self.assertEquals(context['tags'], 0) self.assertEquals(context['authors'], 0) self.assertEquals(context['comments'], 0) self.assertEquals(context['pingbacks'], 0) self.assertEquals(context['trackbacks'], 0) self.assertEquals(context['rejects'], 0) self.assertEquals(context['words_per_entry'], 0) self.assertEquals(context['words_per_comment'], 0) self.assertEquals(context['entries_per_month'], 0) self.assertEquals(context['comments_per_entry'], 0) self.assertEquals(context['linkbacks_per_entry'], 0) site = Site.objects.get_current() Category.objects.create(title='Category 1', slug='category-1') author = Author.objects.create_user(username='******', email='*****@*****.**') comments.get_model().objects.create( comment='My Comment 1', site=site, content_object=self.entry, submit_date=timezone.now()) self.entry.authors.add(author) self.publish_entry() with self.assertNumQueries(13): context = zinnia_statistics('custom_template.html') self.assertEquals(context['template'], 'custom_template.html') self.assertEquals(context['entries'], 1) self.assertEquals(context['categories'], 1) self.assertEquals(context['tags'], 2) self.assertEquals(context['authors'], 1) self.assertEquals(context['comments'], 1) self.assertEquals(context['pingbacks'], 0) self.assertEquals(context['trackbacks'], 0) self.assertEquals(context['rejects'], 0) self.assertEquals(context['words_per_entry'], 2) self.assertEquals(context['words_per_comment'], 3) self.assertEquals(context['entries_per_month'], 1) self.assertEquals(context['comments_per_entry'], 1) self.assertEquals(context['linkbacks_per_entry'], 0)
def test_zinnia_statistics(self): context = zinnia_statistics() self.assertEquals(context["template"], "zinnia/tags/statistics.html") self.assertEquals(context["entries"], 0) self.assertEquals(context["categories"], 0) self.assertEquals(context["tags"], 0) self.assertEquals(context["authors"], 0) self.assertEquals(context["comments"], 0) self.assertEquals(context["pingbacks"], 0) self.assertEquals(context["trackbacks"], 0) self.assertEquals(context["rejects"], 0) self.assertEquals(context["words_per_entry"], 0) self.assertEquals(context["words_per_comment"], 0) self.assertEquals(context["entries_per_month"], 0) self.assertEquals(context["comments_per_entry"], 0) self.assertEquals(context["linkbacks_per_entry"], 0) site = Site.objects.get_current() Category.objects.create(title="Category 1", slug="category-1") user = User.objects.create_user(username="******", email="*****@*****.**") comments.get_model().objects.create(comment="My Comment 1", site=site, content_object=self.entry) self.entry.authors.add(user) self.publish_entry() context = zinnia_statistics("custom_template.html") self.assertEquals(context["template"], "custom_template.html") self.assertEquals(context["entries"], 1) self.assertEquals(context["categories"], 1) self.assertEquals(context["tags"], 2) self.assertEquals(context["authors"], 1) self.assertEquals(context["comments"], 1) self.assertEquals(context["pingbacks"], 0) self.assertEquals(context["trackbacks"], 0) self.assertEquals(context["rejects"], 0) self.assertEquals(context["words_per_entry"], 2) self.assertEquals(context["words_per_comment"], 3) self.assertEquals(context["entries_per_month"], 0) self.assertEquals(context["comments_per_entry"], 1) self.assertEquals(context["linkbacks_per_entry"], 0)