Over the weekend I was hanging out with some other coders and one of them asked me if I could help with
ModelForms. I said I hadn't written any
ModelForms yet, but I was sure to have to learn about them soon, so I offered to take a look with them.
There are five lights! (Continued…)
With our migrations fixed, we could now get on with the business of writing tests. Django uses Python's standard
unittest package, which I'm well familiar with.
We did a straightforward sort of
TestCase, creating a User object and other instances of models needed by the code under test, we put that in a
setUp method, and after we'd written a few of these, I asked
shouldn't we write a
tearDown method to clean up all these objects we've been creating?
My partner looked at me like I'd just suggested we put ice cubes on the pizza.
Why would we do that?
Why, or why not, involves transactions. (Continued…)