Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: Fix frontend integration tests failure #370

Merged
merged 2 commits into from
Jul 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions tests/frontendIntegration/django2x/polls/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
name="multipleInterceptors",
),
path("", views.get_info, name="/"), # type: ignore
path("check-rid-no-session", views.check_rid_no_session, name="check-rid-no-session"), # type: ignore
path("update-jwt", views.update_jwt, name="update_jwt"), # type: ignore
path("update-jwt-with-handle", views.update_jwt_with_handle, name="update_jwt_with_handle"), # type: ignore
path("session-claims-error", views.session_claim_error_api, name="session_claim_error_api"), # type: ignore
Expand Down
5 changes: 5 additions & 0 deletions tests/frontendIntegration/django2x/polls/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,11 @@ def get_info(request: HttpRequest):
return HttpResponse("")


def check_rid_no_session(request: HttpRequest):
rid = request.headers.get("rid") # type: ignore
return HttpResponse("fail" if rid is None else "success")


@custom_decorator_for_update_jwt()
@verify_session()
def update_jwt(request: HttpRequest):
Expand Down
1 change: 1 addition & 0 deletions tests/frontendIntegration/django3x/polls/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
name="multipleInterceptors",
),
path("", views.get_info, name="/"), # type: ignore
path("check-rid-no-session", views.check_rid_no_session, name="check-rid-no-session"), # type: ignore
path("update-jwt", views.update_jwt, name="update_jwt"), # type: ignore
path("update-jwt-with-handle", views.update_jwt_with_handle, name="update_jwt_with_handle"), # type: ignore
path("session-claims-error", views.session_claim_error_api, name="session_claim_error_api"), # type: ignore
Expand Down
5 changes: 5 additions & 0 deletions tests/frontendIntegration/django3x/polls/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,11 @@ async def get_info(request: HttpRequest):
return HttpResponse("")


def check_rid_no_session(request: HttpRequest):
rid = request.headers.get("rid") # type: ignore
return HttpResponse("fail" if rid is None else "success")


@custom_decorator_for_update_jwt()
@verify_session()
async def update_jwt(request: HttpRequest):
Expand Down
6 changes: 6 additions & 0 deletions tests/frontendIntegration/fastapi-server/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,12 @@ async def get_info(r_session: SessionContainer = Depends(verify_session())):
)


@app.get("/check-rid-no-session")
def check_rid_no_session_api(request: Request):
rid = request.headers.get("rid")
return PlainTextResponse("fail" if rid is None else "success")


@app.options("/update-jwt")
def update_options():
return send_options_api_response()
Expand Down
6 changes: 6 additions & 0 deletions tests/frontendIntegration/flask-server/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,12 @@ def get_info():
return resp


@app.route("/check-rid-no-session", methods=["GET"]) # type: ignore
def check_rid_no_session():
rid = request.headers.get("rid")
return "fail" if rid is None or not rid.startswith("anti-csrf") else "success"


@app.route("/update-jwt", methods=["OPTIONS"]) # type: ignore
def update_options():
return send_options_api_response()
Expand Down
Loading