database: minor refactoring on unit tests