consistently remove domain from short hostname

Signed-off-by: Dmitry Borodaenko <angdraug@gmail.com>
split unit test into two, fix typo in comments

Signed-off-by: Dmitry Borodaenko <angdraug@gmail.com>
Merge pull request #72 from angdraug/6269

consistently remove domain from short hostname