Db fixes

Support both direct DB connections and connections via fh.db

Make files more modular.
Oh wait, you're already using sinon in other tests. Great