Cleaning up those things would be nice.  Abstracting out the raw SQL from our tests could be treated as an orthogonal problem, though.  There are lots of tests that query things related to nodes, so having a testutils namespace that provides the necessary functions that seems beneficial to me.

The fact that it's a simple query is kind of beside the point... the point is that we are perpetuating a pattern that produces less maintainable code and mixes the implementation details into the test logic.