Test clean-up pass

- Move most queries and schemas inline to avoid unnecessary indirections when
  looking at failing tests. This also avoids some repetition in comments etc.
- Add FIXMEs for switching to the REST interface