Add unittest for db