From ada647df79fd6d30c8e8311729d3f72ab16665ea Mon Sep 17 00:00:00 2001 From: Frank Longford <50372949+flongford@users.noreply.github.com> Date: Mon, 30 May 2022 12:26:54 +0100 Subject: [PATCH] Update `jupyterhub` to 0.9.x series (#604) * MAINT: update jupyterhub to 0.9.0 * MAINT: add sqlalchemy version constraint to fix deprecated package bug * TST: update expected cookie name for spawner login * TST: remove expected log message * Revert "TST: remove expected log message" This reverts commit 1f5a2f0d5551a326dc5376346ac8c04fbb776b67. * TST: fix selenium tests for admin logins * ENH: minor change to spawner options form html * TST: fix to mocking in BaseHandler tests * MAINT: bump jupyterhub to latest patch in 0.9.x series * FIX: ensure spawner stop_single_user is waited for when logging admin out * TST: potential fix to flakey selenium test * TST: wait for modal to disappear from flakey selenium test --- remoteappmanager/handlers/tests/test_base_handler.py | 4 +++- .../jupyterhub/auth/simphony_remote_auth_mixin.py | 2 +- remoteappmanager/jupyterhub/spawners.py | 2 +- remoteappmanager/jupyterhub/tests/test_spawners.py | 4 ++-- requirements.txt | 4 +++- selenium_tests/AdminDriverTest.py | 1 - selenium_tests/UserDriverTest.py | 3 +++ selenium_tests/test_spawner_options_form.py | 2 -- setup.py | 2 +- 9 files changed, 14 insertions(+), 10 deletions(-) diff --git a/remoteappmanager/handlers/tests/test_base_handler.py b/remoteappmanager/handlers/tests/test_base_handler.py index e62c92381..7ad0568bc 100644 --- a/remoteappmanager/handlers/tests/test_base_handler.py +++ b/remoteappmanager/handlers/tests/test_base_handler.py @@ -27,13 +27,15 @@ def get_app(self): return app +@mock.patch.dict('os.environ', {"JUPYTERHUB_CLIENT_ID": 'client-id'}) +@mock.patch('jupyterhub.services.auth.HubOAuth.get_user') class TestBaseHandlerInvalidAccounting(TestBaseHandler): def get_file_config(self): file_config = super().get_file_config() file_config.database_class = 'this_should_fail' return file_config - def test_home_internal_error(self): + def test_home_internal_error(self, mock_get_user): with ExpectLog('tornado.application', ''), \ ExpectLog('tornado.access', ''): res = self.fetch("/user/johndoe/", diff --git a/remoteappmanager/jupyterhub/auth/simphony_remote_auth_mixin.py b/remoteappmanager/jupyterhub/auth/simphony_remote_auth_mixin.py index 866258eac..2d82881cc 100644 --- a/remoteappmanager/jupyterhub/auth/simphony_remote_auth_mixin.py +++ b/remoteappmanager/jupyterhub/auth/simphony_remote_auth_mixin.py @@ -21,7 +21,7 @@ def get(self): if user.admin and user.spawner is not None: self.log.info(f"Shutting down {user.name}'s server") try: - yield gen.maybe_future(self.stop_single_user(user)) + yield self.stop_single_user(user) except HTTPClientError: self.log.warning("Failed to shut down server") self.log.info("User logged out: %s", user.name) diff --git a/remoteappmanager/jupyterhub/spawners.py b/remoteappmanager/jupyterhub/spawners.py index b28e8a8a9..f08a54ab4 100644 --- a/remoteappmanager/jupyterhub/spawners.py +++ b/remoteappmanager/jupyterhub/spawners.py @@ -43,7 +43,7 @@ def _options_form_default(self): if self.user.admin: return """
- + Choose RemoteAppManager Session: