def test_model_creation(self): user = UserFactory.create(username='******') meal = MealFactory.create(user=user) FoodFactory.create(meal=meal) self.assertEqual(Food.objects.count(), 2) self.assertEqual(len(mail.outbox), 2)
def setUp(self): self.food = FoodFactory.create() self.food.meal.user.set_password('password') self.food.meal.user.save()