Hosts unit tests

Hi @jfindlay, Please review the hosts_test case and let me know if you have any review comments.