Clean up the repository API unit tests and prepare for future work.
Clean up the repository API unit tests and prepare for future work.

The repository API unit tests were pretty ancient and crufty, and the
helper functions made a lot of assumptions about what was needed for
repository testing and creation that just didn't hold up anymore (mainly
that repositories were never going to be backed by hosting services). On
top of this, we overrode all kinds of class-level functions directly,
without using kgb, which wasn't very safe.

This cruft is blocking work on finally getting this API into shape to
allow creation of repositories backed by hosting services.

This change cleans up the tests, removing some of the bad assumptions,
making the helper functions more generally useful, moving code to kgb,
and otherwise just simplifying the tests.

Testing Done:
Unit tests pass.

Reviewed at https://reviews.reviewboard.org/r/11319/

reviewboard/reviewboard,chipx86/reviewboard,reviewboard/reviewboard,chipx86/reviewboard,reviewboard/reviewboard,chipx86/reviewboard,chipx86/reviewboard,reviewboard/reviewboard