More tests.
Make db a context manager.