[PATCH 1/7] mf/tests: Move and split some helper code around.