コード例 #1
0
ファイル: test_models.py プロジェクト: eyobofficial/poll-app
 def test_published_recently_with_future_question(self):
     """
     published_recently() returns False for question with future
     pub_date
     """
     future_time = timezone.now() + datetime.timedelta(days=10)
     future_question = Question(pub_date=future_time)
     self.assertIs(future_question.published_recently(), False)
コード例 #2
0
ファイル: test_models.py プロジェクト: eyobofficial/poll-app
 def test_published_recently_with_recent_question(self):
     """
     published_test() method returns True for questions with
     pub_date within the last 5 hours
     """
     recent_time = timezone.now() - datetime.timedelta(hours=4, minutes=59)
     recent_question = Question(pub_date=recent_time)
     self.assertIs(recent_question.published_recently(), True)
コード例 #3
0
ファイル: test_models.py プロジェクト: eyobofficial/poll-app
 def test_published_recently_with_old_question(self):
     """
     published_recently() method returns False for question with
     pub_date older than 5 hours
     """
     old_time = timezone.now() - datetime.timedelta(hours=6)
     old_question = Question(pub_date=old_time)
     self.assertIs(old_question.published_recently(), False)
コード例 #4
0
ファイル: tests.py プロジェクト: nonre/questionp
 def test_published_recently_with_recent_question(self):
     time = timezone.now() - datetime.timedelta(hours=1)
     recent_question = Question(pub_date=time)
     self.assertEqual(recent_question.published_recently(), True)
コード例 #5
0
ファイル: tests.py プロジェクト: nonre/questionp
 def test_published_recently_with_old_question(self):
     time = timezone.now() - datetime.timedelta(days=30)
     old_question = Question(pub_date=time)
     self.assertEqual(old_question.published_recently(), False)
コード例 #6
0
ファイル: tests.py プロジェクト: nonre/questionp
 def test_published_recently_with_future_question(self):
     time = timezone.now() + datetime.timedelta(days=90)
     future_question = Question(pub_date=time)
     self.assertEqual(future_question.published_recently(), False)
コード例 #7
0
ファイル: tests.py プロジェクト: xudongli113/Django_test
	def test_published_recently_with_future_question():
		time = timezone.now() + datetime.timedelta(days=30)
		future_question = Question(pub_data=time)
		self.assertEqual(future_question.published_recently(), False)