pythonflaskoktaopenid-connectwebtest

How to test flask-okta integration?


I have implemented okta integration in flask using oidc.

@route(“/index”)
@oidc.require_login
def index():
    return “ok”

I wanted to write integration test using webtest but instead of 200 getting 302 as oidc is redirecting to okta url.

How can in bypass authentication during test cases exexution


Solution

  • Require login always checks if the oidc_id_token is exists and not expired. We can manually set for the test environment.

    oidc.set_id_token_cookie({‘exp’:unixtime})