Tests boilerplate

Some preparatory cleanup so the new tests I'll write won't have to contain the same boilerplate code over and over.