def test_get_information_holder_with_positions(self): view = SoulMateDetailView() view.object = self.antofa data = { "question-0": "8", "question-1": "11", "question-2": "14", "question-id-0": "4", "question-id-1": "5", "question-id-2": "6" } holder = view.get_information_holder(data=data) for candidate in holder.persons: self.assertIsInstance(candidate, Candidate) self.assertIn(int(candidate.id), [1, 2, 3]) for category in holder.categories: self.assertIsInstance(category, QuestionCategory) self.assertIn(int(category.id), [3, 4]) for position_id in holder.positions: self.assertIsInstance(holder.positions[position_id], TakenPosition) self.assertIn(int(holder.positions[position_id].topic.id), [4, 5, 6]) self.assertIn(int(holder.positions[position_id].position.id), [8, 11, 14]) with self.assertRaises(Person.DoesNotExist): holder.positions[position_id].person
def test_get_information_holder(self): view = SoulMateDetailView() view.object = self.antofa holder = view.get_information_holder() self.assertIsInstance(holder, InformationHolder) for candidate in holder.persons: self.assertIsInstance(candidate, Candidate) self.assertIn(int(candidate.id), [1, 2, 3]) for category in holder.categories: self.assertIsInstance(category, QuestionCategory) self.assertIn(int(category.id), [3, 4])