Add unittest for database