Sketch out "only" middleware
Fix import
Separate queries to a file of their own

This makes it easier to use them at other tests. Still probably need to
work on the module, though, as there are some asserts that likely don't
belong there.