Get `mock_open` working.

Kind of since we're not using `mock_open` from the mocked library. Were
actually using the recipe to mock the builtin open as seen on http://goo.gl/dxMwPO
Run windows specific code on windows only!
Test is now fixed.
More concise fix for empty /etc/hosts line check
Add more get_id tests + some DRY fixes