rework unit test and used urllib instead of httplib