ivan-afonichkin commented on code in PR #35486:
URL: https://github.com/apache/airflow/pull/35486#discussion_r1384110242


##########
tests/www/views/test_session.py:
##########
@@ -98,3 +98,11 @@ def test_check_active_user(app, user_client):
     resp = user_client.get("/home")
     assert resp.status_code == 302
     assert "/logout" in resp.headers.get("Location")
+
+
+def test_check_deactivated_user_redirected_to_login(app, user_client):
+    user = app.appbuilder.sm.find_user(username="test_user")
+    user.active = False
+    resp = user_client.get("/home", follow_redirects=True)
+    assert resp.status_code == 200
+    assert '/login' in resp.request.url

Review Comment:
   Yes, I realized it as well after pushed a test. Thanks for spotting! I 
updated the test, now if you remove the added logic you will get this test 
failing with the following error:
   `FAILED 
tests/www/views/test_session.py::test_check_deactivated_user_redirected_to_login
 - werkzeug.test.ClientRedirectError: Loop detected: A 302 redirect to /logout/ 
was already made.`
   
   Please let me know if there is anything else needed.



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