AbstractDaemonTest: Factor out query convenience method

Change-Id: I16e5acd661150384f485b5cf0cfea92145e460ee
AbstractDaemonTest: Allow changing GerritApi user

Change-Id: I82e0a459a6fc80fab3bbb595abcec5777c744b59