tests: reorganize tests into unit/integration

This is a complete reorganization of the test suite to more properly
divide the tests into unit and integration. All integration tests
require a MySQL server instance setup and will skip themselves if
it is not.