diff --git a/jupyterhub/jupyterhub/handlers/base.py b/jupyterhub/jupyterhub/handlers/base.py index 75d38d00..d6d1c5d9 100644 --- a/jupyterhub/jupyterhub/handlers/base.py +++ b/jupyterhub/jupyterhub/handlers/base.py @@ -1527,14 +1527,10 @@ class UserUrlHandler(BaseHandler): # if request is expecting JSON, assume it's an API request and fail with 503 # because it won't like the redirect to the pending page - if ( - get_accepted_mimetype( - self.request.headers.get('Accept', ''), - choices=['application/json', 'text/html'], - ) - == 'application/json' - or 'api' in user_path.split('/') - ): + if get_accepted_mimetype( + self.request.headers.get('Accept', ''), + choices=['application/json', 'text/html'], + ) == 'application/json' or 'api' in user_path.split('/'): self._fail_api_request(user_name, server_name) return @@ -1616,7 +1612,7 @@ class UserUrlHandler(BaseHandler): if redirects: self.log.warning("Redirect loop detected on %s", self.request.uri) # add capped exponential backoff where cap is 10s - await asyncio.sleep(min(1 * (2 ** redirects), 10)) + await asyncio.sleep(min(1 * (2**redirects), 10)) # rewrite target url with new `redirects` query value url_parts = urlparse(target) query_parts = parse_qs(url_parts.query) diff --git a/jupyterhub/jupyterhub/singleuser/mixins.py b/jupyterhub/jupyterhub/singleuser/mixins.py index 0b3b2207..706375ae 100755 --- a/jupyterhub/jupyterhub/singleuser/mixins.py +++ b/jupyterhub/jupyterhub/singleuser/mixins.py @@ -492,7 +492,7 @@ class SingleUserNotebookAppMixin(Configurable): i, RETRIES, ) - await asyncio.sleep(min(2 ** i, 16)) + await asyncio.sleep(min(2**i, 16)) else: break else: diff --git a/jupyterhub/tests/test_api.py b/jupyterhub/tests/test_api.py index 968fea70..c0a8bcf9 100644 --- a/jupyterhub/tests/test_api.py +++ b/jupyterhub/tests/test_api.py @@ -1873,7 +1873,8 @@ async def test_auth_managed_groups(request, app, group, user): data=json.dumps({"users": [user.name]}), ) assert r.status_code == 400 - + + @mark.group async def test_group_add_properties(app): db = app.db @@ -1899,6 +1900,7 @@ async def test_group_add_properties(app): properties_object[k] for k in properties_object ) + # ----------------- # Service API tests # -----------------