Expose cursor on db classes
Refactor db instantiation to make it callable from individual tests