def setUp(self): # Create a dummy user, category, and two articles for testing self.user = dummy_user() self.category = dummy_category() self.article1 = dummy_article(self.user, self.category, Article.PUBLISHED) self.article2 = dummy_article(self.user, self.category, Article.PUBLISHED) # Make the second article older so that the first one always sorts first self.article2.date -= timedelta(0, 1) self.article2.save()
def setUp(self): # Create the request factory self.factory = RequestFactory() # Create three users - two normal users and an admin (staff) self.user1 = dummy_user() self.user2 = dummy_user() self.admin = dummy_user(True) # Create a dummy category self.category = dummy_category()