On 9 Feb 2021, at 1:38, [email protected] wrote:

I'd like to use webtest to test my application's responses with an
authenticated user. I tried everything with mocking, monkeypatch, etc. but couldn't figure out. I see that there is testing_securitypolicy but I have
no idea how could I integrate it with webtest.

Kotti’s test suite uses a ``pytest`` marker for running tests with an authenticated user. The ``webtest`` fixture monkey patches ``pyramid.authentication.AuthTktAuthenticationPolicy.unauthenticated_userid`` (https://github.com/Kotti/Kotti/blob/master/kotti/tests/__init__.py#L296). It can be used like this: https://github.com/Kotti/Kotti/blob/master/kotti/tests/test_functional.py#L218.

HTH,
Andreas

--
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/pylons-discuss/D3613475-2D22-4732-A779-6AC6CAEE8764%40binary-punks.com.

Reply via email to