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


##########
providers/tests/amazon/aws/auth_manager/router/test_login.py:
##########
@@ -126,16 +113,13 @@ def test_login_callback_set_user_in_session(self):
                     "email": ["email"],
                 }
                 mock_init_saml_auth.return_value = auth
-                app = application.create_app(testing=True)
-                with app.test_client() as client:
-                    response = client.get("/login_callback")
-                    assert response.status_code == 302
-                    assert response.location == url_for("Airflow.index")
-                    assert session["aws_user"] is not None
-                    assert session["aws_user"].get_id() == "1"
-                    assert session["aws_user"].get_name() == "user_id"
-
-    def test_login_callback_raise_exception_if_errors(self):
+                client = TestClient(create_app())
+                response = client.post("/auth/login_callback", 
follow_redirects=False)
+                assert response.status_code == 303

Review Comment:
   Good question! By default a redirection will use the same method as the one 
used to land on that page. Here `/auth/login_callback`, uses the method `POST`, 
then if you do a normal redirection, it will create a redirection but using 
`POST`. It does not makes sense. I want a `GET`. `303` has been created for 
that purposes. `303` redirect is the same as a 302 (ie. temporary) except that 
the follow-up request is now explicitly changed to a GET request and no 
confirmation is required.



-- 
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: commits-unsubscr...@airflow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to