Fixed merge request after cherrypick

This commit is contained in:
0mar
2020-12-07 15:41:34 +01:00
committed by 0mar
parent 6fc3dc4c01
commit 4ab2e3aa0a
4 changed files with 9 additions and 9 deletions

View File

@@ -57,8 +57,6 @@ class RootAPIHandler(APIHandler):
def get(self):
"""GET /api/ returns info about the Hub and its API.
It is not an authenticated endpoint.
For now, it just returns the version of JupyterHub itself.
"""
data = {'version': __version__}
@@ -66,12 +64,11 @@ class RootAPIHandler(APIHandler):
class InfoAPIHandler(APIHandler):
@needs_scope('read:hub')
def get(self):
"""GET /api/info returns detailed info about the Hub and its API.
It is not an authenticated endpoint.
For now, it just returns the version of JupyterHub itself.
Currently, it returns information on the python version, spawner and authenticator
"""
def _class_info(typ):

View File

@@ -1618,14 +1618,16 @@ async def test_root_api(app):
if app.internal_ssl:
kwargs['cert'] = (app.internal_ssl_cert, app.internal_ssl_key)
kwargs["verify"] = app.internal_ssl_ca
r = await async_requests.get(url, **kwargs)
with mock_role(app):
r = await api_request(app, bypass_proxy=True)
r.raise_for_status()
expected = {'version': jupyterhub.__version__}
assert r.json() == expected
async def test_info(app):
r = await api_request(app, 'info')
with mock_role(app):
r = await api_request(app, 'info')
r.raise_for_status()
data = r.json()
assert data['version'] == jupyterhub.__version__

View File

@@ -97,7 +97,7 @@ class MockAPIHandler:
def group_thing(self, group_name):
return True
@needs_scope('services')
@needs_scope('read:services')
def service_thing(self, service_name):
return True
@@ -133,7 +133,7 @@ class MockAPIHandler:
('maybe', 'bluth2'),
False,
),
(['services'], 'service_thing', ('service1',), True),
(['read:services'], 'service_thing', ('service1',), True),
(
['users!user=george', 'read:groups!group=bluths'],
'group_thing',

View File

@@ -223,6 +223,7 @@ def get_scopes(role='admin'):
'services',
'proxy',
'shutdown',
'read:hub',
],
'user': [
'all',