vincbeck commented on code in PR #77619:
URL: https://github.com/apache/airflow/pull/77619#discussion_r4721253480


##########
providers/fab/tests/unit/fab/auth_manager/views/test_auth_login.py:
##########
@@ -140,6 +143,42 @@ def test_anonymous_login_uses_parent(self, flask_app, 
view_class, parent_class,
         parent_login.assert_called_once_with(*expected_args)
 
 
+class TestEndSessionOnLogout:
+    @pytest.mark.parametrize(
+        "view_class",
+        [CustomAuthDBView, CustomAuthLDAPView, CustomAuthOAuthView, 
CustomAuthRemoteUserView],
+    )
+    @pytest.mark.parametrize(
+        ("logout_redirect_url", "expected_location"),
+        [
+            (None, "/login/"),
+            ("https://idp.example.com/logout";, 
"https://idp.example.com/logout";),
+        ],
+    )
+    @mock.patch.object(AuthView, "logout", autospec=True, 
return_value=Response(status=302))
+    def test_logout_clears_session_and_redirects(
+        self, parent_logout, flask_app, view_class, logout_redirect_url, 
expected_location
+    ):
+        flask_app.secret_key = "test-secret"
+        if logout_redirect_url:
+            flask_app.config["LOGOUT_REDIRECT_URL"] = logout_redirect_url
+        view = view_class()
+        view.appbuilder = mock.Mock(spec=AppBuilder, 
get_url_for_login="/login/")
+        with flask_app.test_request_context("/logout/"):
+            session["csrf_token"] = "token"
+            response = view.logout()
+
+            assert not session
+
+        parent_logout.assert_called_once_with(view)
+        assert response.status_code == 302
+        assert response.location == expected_location
+
+
+def test_security_manager_uses_custom_remote_user_view():

Review Comment:
   nit: no need to have a test for that



-- 
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]

Reply via email to