示例#1
0
 def test_sorting_creator(self):
     """Sorting threads by creator."""
     ThreadFactory(creator__username='******')
     ThreadFactory(creator__username='******')
     threads = sort_threads(Thread.objects, 3, 1)
     self.assertTrue(
         threads[0].creator.username >= threads[1].creator.username)
示例#2
0
 def test_sorting_creator(self):
     """Sorting threads by creator."""
     thread(creator=user(username='******', save=True), save=True)
     thread(creator=user(username='******', save=True), save=True)
     threads = sort_threads(Thread.objects, 3, 1)
     self.assert_(threads[0].creator.username >=
                  threads[1].creator.username)
示例#3
0
 def test_sorting_last_post_desc(self):
     """Sorting threads by last_post descendingly."""
     ThreadFactory(posts=[{}, {}, {}])
     PostFactory(created=datetime.now() - timedelta(days=1))
     threads = sort_threads(Thread.objects, 5, 1)
     self.assertTrue(
         threads[0].last_post.created >= threads[1].last_post.created)
示例#4
0
 def test_sorting_creator(self):
     """Sorting threads by creator."""
     thread(creator=user(username='******', save=True), save=True)
     thread(creator=user(username='******', save=True), save=True)
     threads = sort_threads(Thread.objects, 3, 1)
     self.assert_(
         threads[0].creator.username >= threads[1].creator.username)
示例#5
0
 def test_sorting_replies(self):
     """Sorting threads by replies."""
     t = thread(save=True)
     post(thread=t, save=True)
     post(thread=t, save=True)
     post(thread=t, save=True)
     post(save=True)
     threads = sort_threads(Thread.objects, 4)
     self.assert_(threads[0].replies <= threads[1].replies)
示例#6
0
 def test_sorting_replies(self):
     """Sorting threads by replies."""
     t = thread(save=True)
     post(thread=t, save=True)
     post(thread=t, save=True)
     post(thread=t, save=True)
     post(save=True)
     threads = sort_threads(Thread.objects, 4)
     self.assert_(threads[0].replies <= threads[1].replies)
示例#7
0
 def test_sorting_last_post_desc(self):
     """Sorting threads by last_post descendingly."""
     t = thread(save=True)
     post(thread=t, save=True)
     post(thread=t, save=True)
     post(thread=t, save=True)
     post(created=datetime.now() - timedelta(days=1), save=True)
     threads = sort_threads(Thread.objects, 5, 1)
     self.assert_(
         threads[0].last_post.created >= threads[1].last_post.created)
示例#8
0
 def test_sorting_last_post_desc(self):
     """Sorting threads by last_post descendingly."""
     t = thread(save=True)
     post(thread=t, save=True)
     post(thread=t, save=True)
     post(thread=t, save=True)
     post(created=datetime.now() - timedelta(days=1), save=True)
     threads = sort_threads(Thread.objects, 5, 1)
     self.assert_(threads[0].last_post.created >=
                  threads[1].last_post.created)
示例#9
0
 def test_sorting_replies(self):
     """Sorting threads by replies."""
     ThreadFactory(posts=[{}, {}, {}])
     ThreadFactory()
     threads = sort_threads(Thread.objects, 4)
     self.assertTrue(threads[0].replies <= threads[1].replies)
示例#10
0
 def test_sorting_creator(self):
     """Sorting threads by creator."""
     ThreadFactory(creator__username='******')
     ThreadFactory(creator__username='******')
     threads = sort_threads(Thread.objects, 3, 1)
     self.assert_(threads[0].creator.username >= threads[1].creator.username)
示例#11
0
 def test_sorting_last_post_desc(self):
     """Sorting threads by last_post descendingly."""
     ThreadFactory(posts=[{}, {}, {}])
     PostFactory(created=datetime.now() - timedelta(days=1))
     threads = sort_threads(Thread.objects, 5, 1)
     self.assert_(threads[0].last_post.created >= threads[1].last_post.created)
示例#12
0
 def test_sorting_replies(self):
     """Sorting threads by replies."""
     ThreadFactory(posts=[{}, {}, {}])
     ThreadFactory()
     threads = sort_threads(Thread.objects, 4)
     self.assert_(threads[0].replies <= threads[1].replies)