api: handle case where metadata is None

This fixes bug #1158808

Change-Id: Ib63f42417262544b12f3cdf267d3c2f2eb47746a
Signed-off-by: Julien Danjou <julien@danjou.info>
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>
api: run list_sources tests on SQL and Mongo backend

Change-Id: I59d27548b66c7681ae331a3f342d8277a258f4c2
Signed-off-by: Julien Danjou <julien@danjou.info>
api: run max_volume tests on SQL backend too

Change-Id: I470bd12ff2d10c084bbf2d1582c529017af316be
Signed-off-by: Julien Danjou <julien@danjou.info>
Merge "api: handle case where metadata is None"