484 unit test and refactor

Framework related unit test updates such as test_database, test_plugin, ...

Related gh484