reverse instead of hardcoding URL

another change is to using HTTP status code constant from httplib instead of
numerics, such as 301, 302, etc. This makes test code more readable.