feng-tao commented on a change in pull request #4973: [AIRFLOW-4155] Allow 
Public role access to /home
URL: https://github.com/apache/airflow/pull/4973#discussion_r268930130
 
 

 ##########
 File path: tests/www/test_security.py
 ##########
 @@ -308,3 +308,26 @@ def test_override_role_vm(self):
         test_security_manager = TestSecurityManager(appbuilder=self.appbuilder)
         self.assertEqual(len(test_security_manager.VIEWER_VMS), 1)
         self.assertEqual(test_security_manager.VIEWER_VMS, {'Airflow'})
+
+    def test_is_user_logged_in_returns_false_if_not_authenticated(self):
+        user = mock.MagicMock()
+        user.is_authenticated = False
+        self.assertFalse(self.security_manager.is_user_logged_in(user))
+
+    def test_is_user_logged_in_returns_true_if_authenticated(self):
+        user = mock.MagicMock()
+        user.is_authenticated = True
+        self.assertTrue(self.security_manager.is_user_logged_in(user))
+
+    def test_unauthenticated_user_is_public(self):
+        user = mock.MagicMock()
+        user.is_authenticated = False
+        self.assertTrue(self.security_manager.is_public_user(user))
 
 Review comment:
   @ashb, could you elaborate your concern? Currently this should just let the 
user know that they need to register with certain type of roles to view the dag 
instead of blank page. I think this will help to make the onboarding for a new 
user smoother.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to