Add some unit tests for models/db