Esempio n. 1
0
	def test_was_published_recently_with_old_article(self):
		"""
		was_published_recently() should return False for articles whose pub_date
		is older than one day
		"""
		old_article = Article(pub_date=timezone.now() - datetime.timedelta(days=30))
		self.assertEqual(old_article.was_published_recently(), False)
Esempio n. 2
0
	def test_was_published_recently_with_recent_article(self):
		"""
		was_published_recently() should return True for articles whose pub_date
		is within the last day
		"""
		recent_article = Article(pub_date=timezone.now() - datetime.timedelta(hours=1))
		self.assertEqual(recent_article.was_published_recently(), True)		
Esempio n. 3
0
	def test_was_published_recently_with_future_article(self):
		"""
		was_published_recently() should return False for articles whose 
		pub_date is in the future.
		"""
		future_article = Article(pub_date=timezone.now() + datetime.timedelta(days=30))
		self.assertEqual(future_article.was_published_recently(), False)