I'm writing some unit tests for django views prote...
# support-questions-legacy
j
I'm writing some unit tests for django views protected by
supertokens_python.recipe.session.framework.django.asyncio.verify_session
and i'm wondering what's the best way to proceed.
I'm currently getting unauthorized errors and considering the following options: 1. Mocking out the
verify_session
decorator, but this seems annoying - https://stackoverflow.com/questions/7667567/can-i-patch-a-python-decorator-before-it-wraps-a-function 2. Bypassing supertokens and falling back to django's
request.user
, but this changes the code path. 3. Having the test request send the right headers/cookies to pass the supertokens verification, but I'm not sure what the right headers/cookies would be.
My preference is to get #3 working but curious what you folks would recommend
r
Hey! The third approach is the best. You would need to pass the sAccessToken and sIdRefreshToken as cookies in the request.
2 Views