Rewrite urls submodule so it is easier to test

* I factored out the proxy generation into a separate method (the type builtin can't be patched, so this refactoring allows proxy generation to be stubbed).
* I added a docstring
* I fixed the pattern that was being generated so that suffixes of the generated urls would appropriately be passed to the downstream proxy. Before, if you used generate_routes, a prefix like /yay/ would proxy to the base_url, but so would /yay/cats/dogs/kittens/. This fix makes it so that /yay/cats/dogs/kittens/ will proxy base_url + cats/dogs/kittens/.

This includes a rewritten test suite with much broader coverage.