kalluripradeep commented on code in PR #64418:
URL: https://github.com/apache/airflow/pull/64418#discussion_r3033951957
##########
providers/fab/tests/unit/fab/auth_manager/api_fastapi/routes/test_login.py:
##########
@@ -54,18 +58,22 @@ def test_create_token_cli(self,
mock_fab_auth_manager_login, test_client):
assert response.status_code == 201
assert response.json()["access_token"] == self.dummy_token.access_token
- def test_logout(self, test_client):
+
@patch("airflow.providers.fab.auth_manager.api_fastapi.routes.login._get_flask_app")
+ def test_logout(self, mock_get_flask_app, test_client):
+
mock_get_flask_app.return_value.app_context.return_value.__enter__.return_value
= None
response = test_client.get("/logout", follow_redirects=False)
assert response.status_code == 307
assert response.headers["location"] == "/auth/login"
cookies = response.headers.get_list("set-cookie")
assert any("session=" in c for c in cookies)
assert any(f"{COOKIE_NAME_JWT_TOKEN}=" in c for c in cookies)
+
@patch("airflow.providers.fab.auth_manager.api_fastapi.routes.login._get_flask_app")
@patch(
"airflow.providers.fab.auth_manager.api_fastapi.routes.login.get_cookie_path",
return_value=SUBPATH
)
- def test_logout_cookie_uses_subpath(self, mock_cookie_path, test_client):
+ def test_logout_cookie_uses_subpath(self, mock_cookie_path,
mock_get_flask_app, test_client):
+
mock_get_flask_app.return_value.app_context.return_value.__enter__.return_value
= None
"""Cookies on logout must be scoped to the configured subpath."""
Review Comment:
Fixed. Moved the docstring to be the first statement in the function so it
actually works as a docstring.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]