mirror of
https://github.com/jupyterhub/jupyterhub.git
synced 2025-10-11 20:13:02 +00:00
Fixed merge request after cherrypick
This commit is contained in:
@@ -57,8 +57,6 @@ class RootAPIHandler(APIHandler):
|
|||||||
def get(self):
|
def get(self):
|
||||||
"""GET /api/ returns info about the Hub and its API.
|
"""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.
|
For now, it just returns the version of JupyterHub itself.
|
||||||
"""
|
"""
|
||||||
data = {'version': __version__}
|
data = {'version': __version__}
|
||||||
@@ -66,12 +64,11 @@ class RootAPIHandler(APIHandler):
|
|||||||
|
|
||||||
|
|
||||||
class InfoAPIHandler(APIHandler):
|
class InfoAPIHandler(APIHandler):
|
||||||
|
@needs_scope('read:hub')
|
||||||
def get(self):
|
def get(self):
|
||||||
"""GET /api/info returns detailed info about the Hub and its API.
|
"""GET /api/info returns detailed info about the Hub and its API.
|
||||||
|
|
||||||
It is not an authenticated endpoint.
|
Currently, it returns information on the python version, spawner and authenticator
|
||||||
|
|
||||||
For now, it just returns the version of JupyterHub itself.
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def _class_info(typ):
|
def _class_info(typ):
|
||||||
|
@@ -1618,13 +1618,15 @@ async def test_root_api(app):
|
|||||||
if app.internal_ssl:
|
if app.internal_ssl:
|
||||||
kwargs['cert'] = (app.internal_ssl_cert, app.internal_ssl_key)
|
kwargs['cert'] = (app.internal_ssl_cert, app.internal_ssl_key)
|
||||||
kwargs["verify"] = app.internal_ssl_ca
|
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()
|
r.raise_for_status()
|
||||||
expected = {'version': jupyterhub.__version__}
|
expected = {'version': jupyterhub.__version__}
|
||||||
assert r.json() == expected
|
assert r.json() == expected
|
||||||
|
|
||||||
|
|
||||||
async def test_info(app):
|
async def test_info(app):
|
||||||
|
with mock_role(app):
|
||||||
r = await api_request(app, 'info')
|
r = await api_request(app, 'info')
|
||||||
r.raise_for_status()
|
r.raise_for_status()
|
||||||
data = r.json()
|
data = r.json()
|
||||||
|
@@ -97,7 +97,7 @@ class MockAPIHandler:
|
|||||||
def group_thing(self, group_name):
|
def group_thing(self, group_name):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
@needs_scope('services')
|
@needs_scope('read:services')
|
||||||
def service_thing(self, service_name):
|
def service_thing(self, service_name):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
@@ -133,7 +133,7 @@ class MockAPIHandler:
|
|||||||
('maybe', 'bluth2'),
|
('maybe', 'bluth2'),
|
||||||
False,
|
False,
|
||||||
),
|
),
|
||||||
(['services'], 'service_thing', ('service1',), True),
|
(['read:services'], 'service_thing', ('service1',), True),
|
||||||
(
|
(
|
||||||
['users!user=george', 'read:groups!group=bluths'],
|
['users!user=george', 'read:groups!group=bluths'],
|
||||||
'group_thing',
|
'group_thing',
|
||||||
|
@@ -223,6 +223,7 @@ def get_scopes(role='admin'):
|
|||||||
'services',
|
'services',
|
||||||
'proxy',
|
'proxy',
|
||||||
'shutdown',
|
'shutdown',
|
||||||
|
'read:hub',
|
||||||
],
|
],
|
||||||
'user': [
|
'user': [
|
||||||
'all',
|
'all',
|
||||||
|
Reference in New Issue
Block a user