api: run list_resources test against SQL

This led me to discover and fix bug #1144837, which makes the SQL engine
returns correctly the list of resources when asked.

This also fixes a bug in the /resources listing in MongoDB driver: it used
to filter on the resource db, which only contains the most recent up to date
version of some fields, and returns wrong results.

This also fixes bug #1131349

Change-Id: I7441a8f2839c7db198c80de75f5c39f0dd219813
Signed-off-by: Julien Danjou <julien@danjou.info>