mirror of
https://github.com/jupyterhub/jupyterhub.git
synced 2025-10-12 20:43:02 +00:00
Clean up vertical spacing
This commit is contained in:
@@ -45,6 +45,7 @@ def check_db_locks(func):
|
||||
def find_user(db, name):
|
||||
return db.query(orm.User).filter(orm.User.name == name).first()
|
||||
|
||||
|
||||
def add_user(db, app=None, **kwargs):
|
||||
orm_user = find_user(db, name=kwargs.get('name'))
|
||||
if orm_user is None:
|
||||
@@ -60,6 +61,7 @@ def add_user(db, app=None, **kwargs):
|
||||
else:
|
||||
return orm_user
|
||||
|
||||
|
||||
def auth_header(db, name):
|
||||
user = find_user(db, name)
|
||||
if user is None:
|
||||
@@ -67,6 +69,7 @@ def auth_header(db, name):
|
||||
token = user.new_api_token()
|
||||
return {'Authorization': 'token %s' % token}
|
||||
|
||||
|
||||
@check_db_locks
|
||||
def api_request(app, *api_path, **kwargs):
|
||||
"""Make an API request"""
|
||||
@@ -85,6 +88,7 @@ def api_request(app, *api_path, **kwargs):
|
||||
assert 'http' not in resp.headers['Content-Security-Policy']
|
||||
return resp
|
||||
|
||||
|
||||
def test_auth_api(app):
|
||||
db = app.db
|
||||
r = api_request(app, 'authorizations', 'gobbledygook')
|
||||
@@ -157,6 +161,7 @@ def test_referer_check(app, io_loop):
|
||||
|
||||
# user API tests
|
||||
|
||||
|
||||
@mark.user
|
||||
def test_get_users(app):
|
||||
db = app.db
|
||||
@@ -353,6 +358,7 @@ def get_app_user(app, name):
|
||||
No ORM methods should be called on the result.
|
||||
"""
|
||||
q = Queue()
|
||||
|
||||
def get_user_id():
|
||||
user = find_user(app.db, name)
|
||||
q.put(user.id)
|
||||
@@ -552,7 +558,6 @@ def test_bad_get_token(app):
|
||||
}))
|
||||
assert r.status_code == 403
|
||||
|
||||
# group API tests
|
||||
|
||||
@mark.group
|
||||
def test_groups_list(app):
|
||||
|
Reference in New Issue
Block a user