Esempio n. 1
0
 def setUp(self):
     self.data = [
         Poll(id=1, question="Question 1", pub_date=timezone.now()),
         Poll(id=2, question="Question 2", pub_date=timezone.now()),
         Poll(id=3, question="Question 3", pub_date=timezone.now()),
         Poll(id=4, question="Question 4", pub_date=timezone.now()),
         Poll(id=5, question="Question 5", pub_date=timezone.now()),
     ]
     self.data_with_excluded_fields = [
         PollWithExcludeFields(id=1,
                               question="Question 1",
                               pub_date=timezone.now()),
         PollWithExcludeFields(id=2,
                               question="Question 2",
                               pub_date=timezone.now()),
         PollWithExcludeFields(id=3,
                               question="Question 3",
                               pub_date=timezone.now()),
         PollWithExcludeFields(id=4,
                               question="Question 4",
                               pub_date=timezone.now()),
         PollWithExcludeFields(id=5,
                               question="Question 5",
                               pub_date=timezone.now()),
     ]
 def test_update_change_reason_with_excluded_fields(self):
     poll = PollWithExcludeFields(
         question="what's up?", pub_date=timezone.now(), place="The Pub"
     )
     poll.save()
     update_change_reason(poll, "Test change reason.")
     most_recent = poll.history.order_by("-history_date").first()
     self.assertEqual(most_recent.history_change_reason, "Test change reason.")
 def setUp(self):
     self.data = [
         Poll(id=1, question="Question 1", pub_date=timezone.now()),
         Poll(id=2, question="Question 2", pub_date=timezone.now()),
         Poll(id=3, question="Question 3", pub_date=timezone.now()),
         Poll(id=4, question="Question 4", pub_date=timezone.now()),
         Poll(id=5, question="Question 5", pub_date=timezone.now()),
     ]
     self.data_with_excluded_fields = [
         PollWithExcludeFields(id=1,
                               question="Question 1",
                               pub_date=timezone.now()),
         PollWithExcludeFields(id=2,
                               question="Question 2",
                               pub_date=timezone.now()),
         PollWithExcludeFields(id=3,
                               question="Question 3",
                               pub_date=timezone.now()),
         PollWithExcludeFields(id=4,
                               question="Question 4",
                               pub_date=timezone.now()),
         PollWithExcludeFields(id=5,
                               question="Question 5",
                               pub_date=timezone.now()),
     ]
     self.data_with_alternative_manager = [
         PollWithAlternativeManager(id=1,
                                    question="Question 1",
                                    pub_date=timezone.now()),
         PollWithAlternativeManager(id=2,
                                    question="Question 2",
                                    pub_date=timezone.now()),
         PollWithAlternativeManager(id=3,
                                    question="Question 3",
                                    pub_date=timezone.now()),
         PollWithAlternativeManager(id=4,
                                    question="Question 4",
                                    pub_date=timezone.now()),
         PollWithAlternativeManager(id=5,
                                    question="Question 5",
                                    pub_date=timezone.now()),
     ]
     self.data_with_duplicates = [
         PollWithUniqueQuestion(pk=1,
                                question="Question 1",
                                pub_date=timezone.now()),
         PollWithUniqueQuestion(pk=2,
                                question="Question 2",
                                pub_date=timezone.now()),
         PollWithUniqueQuestion(pk=3,
                                question="Question 1",
                                pub_date=timezone.now()),
     ]