WIP: Mock database calls

Continuation of fcc3ca7

Because PyMongo handles the actual database interaction, I just need to ensure that I'm calling the PyMongo methods with the correct parameters. I plan to mock as many of these methods as possible.

Normally I wouldn't commit in the middle of a task, but since that pattern has already been established for this task I've decided to continue taking periodic snapshots. Here I'm introducing `contextlib.nested()` to make it easier to write multiple patches.

References #3