Unit test for db api, part1.