[WIP] Rewrite query tests

:exclamation: Depends on https://github.com/opf/openproject/pull/693