Пример #1
0
    def test_find_all(self):
        """Test if all trainings which exist in the database are returned"""
        training1 = self._create_sample_training(self.user, "test training1")
        training2 = self._create_sample_training(self.user, "test training2")
        user2 = self._create_sample_user("user2")
        training3 = self._create_sample_training(user2, "test training3")
        found_trainings = TrainingModel.find_all()

        self.assertIn(training1, found_trainings)
        self.assertIn(training2, found_trainings)
        self.assertIn(training3, found_trainings)
Пример #2
0
    def test_find_all_no_trainings(self):
        """Test if an empty list is returned
        if there are no trainings in the database"""
        found_trainings = TrainingModel.find_all()

        self.assertEqual(found_trainings, [])