feature/query tests

This PR is now good to merge. No further changes will be made except at the request of @jmcarp or @JeffSpies.