Make database testing use more explicit and less duplicated