Isolate the network tests from the environment

As we mentioned in #594 things can get odd if we read from the dev's environment whilst testing. This only handles the fetch and refspec tests. The latter were the origin of the other issue, and that is fixed with these changes.

What do you think, should we continue in this vein or is there something better/simpler we could use?