def test_post_absolute_url(self): t = ThreadFactory(posts=[]) # Fill out the first page with posts from yesterday. p1 = PostFactory(thread=t, created=YESTERDAY) PostFactory.create_batch(POSTS_PER_PAGE - 1, created=YESTERDAY, thread=t) # Second page post from today. p2 = PostFactory(thread=t) url = reverse("forums.posts", kwargs={ "forum_slug": p1.thread.forum.slug, "thread_id": p1.thread.id }) eq_(urlparams(url, hash="post-%s" % p1.id), p1.get_absolute_url()) url = reverse("forums.posts", kwargs={ "forum_slug": p2.thread.forum.slug, "thread_id": p2.thread.id }) exp_ = urlparams(url, hash="post-%s" % p2.id, page=2) eq_(exp_, p2.get_absolute_url())
def test_post_absolute_url(self): t = ThreadFactory(posts=[]) # Fill out the first page with posts from yesterday. p1 = PostFactory(thread=t, created=YESTERDAY) PostFactory.create_batch(POSTS_PER_PAGE - 1, created=YESTERDAY, thread=t) # Second page post from today. p2 = PostFactory(thread=t) url = reverse("forums.posts", kwargs={"forum_slug": p1.thread.forum.slug, "thread_id": p1.thread.id}) eq_(urlparams(url, hash="post-%s" % p1.id), p1.get_absolute_url()) url = reverse("forums.posts", kwargs={"forum_slug": p2.thread.forum.slug, "thread_id": p2.thread.id}) exp_ = urlparams(url, hash="post-%s" % p2.id, page=2) eq_(exp_, p2.get_absolute_url())
def test_post_page(self): t = ThreadFactory() # Fill out the first page with posts from yesterday. page1 = PostFactory.create_batch(POSTS_PER_PAGE, thread=t, created=YESTERDAY) # Second page post from today. p2 = PostFactory(thread=t) for p in page1: eq_(1, p.page) eq_(2, p2.page)
def test_post_page(self): t = ThreadFactory() # Fill out the first page with posts from yesterday. page1 = PostFactory.create_batch(POSTS_PER_PAGE, thread=t, created=YESTERDAY) # Second page post from today. p2 = PostFactory(thread=t) for p in page1: eq_(1, p.page) eq_(2, p2.page)