Refactor the test classes

Migrated issue

Reported by: jhodgdon

The number of tests has grown recently, and there are quite a few variations in how the branches are set up and parsed. This has been handled by proliferating base test classes or not using the existing base classes. I think that all the base classes could instead be refactored into one with a bunch of set-up helper functions (and one default setup). Plus, all the nice helper functions that exist in all the base classes should be collected together.