mirror of
https://github.com/jupyterhub/jupyterhub.git
synced 2025-10-15 05:53:00 +00:00
update default note for API-requested tokens
This commit is contained in:
@@ -70,7 +70,7 @@ class TokenAPIHandler(APIHandler):
|
|||||||
|
|
||||||
note = (data or {}).get('note')
|
note = (data or {}).get('note')
|
||||||
if not note:
|
if not note:
|
||||||
note = "via api"
|
note = "Requested via deprecated api"
|
||||||
if requester is not user:
|
if requester is not user:
|
||||||
kind = 'user' if isinstance(user, User) else 'service'
|
kind = 'user' if isinstance(user, User) else 'service'
|
||||||
note += " by %s %s" % (kind, requester.name)
|
note += " by %s %s" % (kind, requester.name)
|
||||||
|
@@ -224,7 +224,7 @@ class UserTokenListAPIHandler(APIHandler):
|
|||||||
kind = 'user' if isinstance(requester, User) else 'service'
|
kind = 'user' if isinstance(requester, User) else 'service'
|
||||||
note = (body or {}).get('note')
|
note = (body or {}).get('note')
|
||||||
if not note:
|
if not note:
|
||||||
note = "via api"
|
note = "Requested via api"
|
||||||
if requester is not user:
|
if requester is not user:
|
||||||
note += " by %s %s" % (kind, requester.name)
|
note += " by %s %s" % (kind, requester.name)
|
||||||
|
|
||||||
|
@@ -1219,7 +1219,7 @@ def test_get_new_token(app, headers, status, note):
|
|||||||
if note:
|
if note:
|
||||||
assert reply['note'] == note
|
assert reply['note'] == note
|
||||||
else:
|
else:
|
||||||
assert reply['note'] == 'via api'
|
assert reply['note'] == 'Requested via api'
|
||||||
token_id = reply['id']
|
token_id = reply['id']
|
||||||
initial = normalize_token(reply)
|
initial = normalize_token(reply)
|
||||||
# pop token for later comparison
|
# pop token for later comparison
|
||||||
|
Reference in New Issue
Block a user