Beispiel #1
0
	def test_was_published_recently_with_recent_album(self):
		"""
		was_published_recently() should return True for albums whose pub_date
		is within the last day.
		"""
		recent_album = Album(album_name="Recent album", pub_date=timezone.now() - datetime.timedelta(hours=1))
		self.assertEqual(recent_album.was_published_recently(), True)
Beispiel #2
0
	def test_was_published_recently_with_future_album(self):
		"""
		was_published_recently() should return False for albums whose
		pub_date is in the future.
		"""
		future_album = Album(album_name="Future album", pub_date=timezone.now() + datetime.timedelta(days=30))
		self.assertEqual(future_album.was_published_recently(), False)
Beispiel #3
0
	def test_was_published_recently_with_old_album(self):
		"""
		was_published_recently() should return False for albums whose pub_date
		is older than 1 day.
		"""
		old_album = Album(album_name="Old album", pub_date=timezone.now() - datetime.timedelta(days=2))
		self.assertEqual(old_album.was_published_recently(), False)