Skip to content

add helper class to analyze response.location#276

Open
bdauvergne wants to merge 3 commits into
Pylons:mainfrom
bdauvergne:wip/location
Open

add helper class to analyze response.location#276
bdauvergne wants to merge 3 commits into
Pylons:mainfrom
bdauvergne:wip/location

Conversation

@bdauvergne

@bdauvergne bdauvergne commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Suggestion by @gawel, a new webtest.utils.URL class used to return response.location/content_location/url and simplify tests, with pytest you can write things as simple as:

     assert resp.location.match('https://example.org/a/b/c')
     assert resp.location.match('?foo=bar')

and you get clear errors on output

        def test_location(self):
        app = webtest.TestApp(debug_app)
        res = app.post('/')
        res.location = 'http://pylons.org'
        self.assertTrue(res.location.match('http://'))
>       self.assertTrue(res.url.match('https://truc.org'))
E       AssertionError: scheme differs http != https is not true

@bdauvergne
bdauvergne force-pushed the wip/location branch 5 times, most recently from cd177a5 to 3c1d374 Compare July 21, 2026 10:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant