Simplify Django test set up with mock objects
问题 Often when I'm writing tests for my Django project, I have to write a lot more code to set up database records than I do to actually test the object under test. Currently, I try to use test fixtures to store the related fields, but could I use mock objects to mock out the related tables that take so much work to set up? Here's a trivial example. I want to test that a Person object will spawn() children according to its health. In this case, a person's city is a required field, so I have to