Test changes for debain based installations

On debian based linux installations the hostname and localhost resolve to different IPs. 
I've made the offending tests pass, but but I'm not 100% sure that the tests are still testing the functionality they are intended to.
Please look over carefully.