improved test: now checking what's inserted in the database