This is an automated email from the ASF dual-hosted git repository.

vincbeck pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/main by this push:
     new 9d4f85e74e8 Fix AWS auth manager system test (#49561)
9d4f85e74e8 is described below

commit 9d4f85e74e81b8d5dcb359b0e132bdd95c7febd0
Author: Vincent <[email protected]>
AuthorDate: Tue Apr 22 13:29:51 2025 -0400

    Fix AWS auth manager system test (#49561)
---
 .../system/amazon/aws/tests/test_aws_auth_manager.py  | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)

diff --git 
a/providers/amazon/tests/system/amazon/aws/tests/test_aws_auth_manager.py 
b/providers/amazon/tests/system/amazon/aws/tests/test_aws_auth_manager.py
index 22551276aba..b342c26362b 100644
--- a/providers/amazon/tests/system/amazon/aws/tests/test_aws_auth_manager.py
+++ b/providers/amazon/tests/system/amazon/aws/tests/test_aws_auth_manager.py
@@ -136,7 +136,7 @@ def base_app(region_name, avp_policy_store_id):
         with (
             patch.object(OneLogin_Saml2_IdPMetadataParser, "parse_remote") as 
mock_parse_remote,
             patch(
-                
"airflow.providers.amazon.aws.auth_manager.router.login._init_saml_auth"
+                
"airflow.providers.amazon.aws.auth_manager.routes.login._init_saml_auth"
             ) as mock_init_saml_auth,
         ):
             mock_parse_remote.return_value = SAML_METADATA_PARSED
@@ -197,12 +197,23 @@ class TestAwsAuthManager:
         for policy_store_id in policy_store_ids:
             client.delete_policy_store(policyStoreId=policy_store_id)
 
-    def test_login_admin(self, client_admin_permissions):
+    def test_login_admin_redirect(self, client_admin_permissions):
         response = client_admin_permissions.post(
-            AUTH_MANAGER_FASTAPI_APP_PREFIX + "/login_callback", 
follow_redirects=False
+            AUTH_MANAGER_FASTAPI_APP_PREFIX + "/login_callback",
+            follow_redirects=False,
+            data={"RelayState": "login-redirect"},
         )
         token = response.cookies.get(COOKIE_NAME_JWT_TOKEN)
         assert response.status_code == 303
         assert "location" in response.headers
-        assert response.headers["location"] == "/"
+        assert response.headers["location"] == "http://localhost:28080";
         assert token is not None
+
+    def test_login_admin_token(self, client_admin_permissions):
+        response = client_admin_permissions.post(
+            AUTH_MANAGER_FASTAPI_APP_PREFIX + "/login_callback",
+            follow_redirects=False,
+            data={"RelayState": "login-token"},
+        )
+        assert response.status_code == 200
+        assert response.json()["access_token"]

Reply via email to