Moved mocking code to a new package in tests/mocking

Moved relevant mocking code to said new package.

Added test database mock to the sphinx documentation patcher.