fix indent in loop, searching for public_ip
adding tests