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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)