Fixes one of the remote-data tests mentioned in #2290

Adds a simple context manager for turn_internet_off/turn_internet_on so that this particular test can work regardless of whether --remote-data is in use.