You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2020/10/22 17:36:58 UTC

[GitHub] [airflow] zhaitin-quotient commented on a change in pull request #11745: Unify user session lifetime configuration

zhaitin-quotient commented on a change in pull request #11745:
URL: https://github.com/apache/airflow/pull/11745#discussion_r510340862



##########
File path: tests/www/test_app.py
##########
@@ -215,3 +217,27 @@ def test_should_set_sqlalchemy_engine_options(self):
             'max_overflow': 5
         }
         self.assertEqual(app.config['SQLALCHEMY_ENGINE_OPTIONS'], engine_params)
+
+    @conf_vars({
+        ('webserver', 'session_lifetime_minutes'): '3600',
+    })
+    @mock.patch("airflow.www.app.app", None)
+    def test_should_set_permanent_session_timeout(self):
+        app = application.cached_app(testing=True)
+        self.assertEqual(app.config['PERMANENT_SESSION_LIFETIME'], timedelta(minutes=3600))
+
+    @conf_vars({
+        ('webserver', 'session_lifetime_days'): '30',
+        ('webserver', 'force_log_out_after'): '30',
+    })
+    @mock.patch("airflow.www.app.app", None)
+    def test_should_emit_deprecation_warnings(self):
+        with pytest.warns(DeprecationWarning) as warns:
+            application.cached_app(testing=True)
+        app_path = str(Path(__file__).parents[2].joinpath('airflow', 'www', 'app.py'))
+        warns = [w for w in warns if w.filename == app_path]
+        self.assertEqual(len(warns), 2)
+        self.assertEqual(warns[0].message.args[0],

Review comment:
       My main issue with this function is that if we tomorrow add new deprecation warnings it can break this test, while it shouldn't.
   Why not just check in general that those messages exists in warns? Why filter by filename and be specific on the index number?




----------------------------------------------------------------
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:
users@infra.apache.org