mercredi 9 septembre 2020

Getting current route in pyramid view test

I'm trying to test a view in pyramid which uses request.current_route_path().

I'm going with the basic test setup, pretty much straight from the doc:

from ..views.auth import signup
...
class ....:
    def test_signup_view(self):
        with testing.testConfig():
            signup(testing.DummyRequest(self.session))

but this results in ValueError: Current request matches no route

I added the path="/signup" param to the DummyRequest, but end up with the same error.

How do I work around this?

Aucun commentaire:

Enregistrer un commentaire