Fix the RepositoryForm unit tests, and make them less error-prone.

My final work for the Bitbucket support broke RepositoryForm unit tests,
and I apparently failed to test those. So, this change fixes it, by
making use of a TestService instead of using an existing hosting service
for tests. This way, we can control things like authorization (which is
what broke the tests before), repository checking, fields, etc.