Add unittests for the query manager