Test with custom query_class