First attempts at testing database code.

More needs to be done here.