mirror of
https://github.com/jupyterhub/jupyterhub.git
synced 2025-10-12 04:23:01 +00:00
Add get_api_pagination method to base handler, revert group.users pagination
This commit is contained in:
@@ -1504,36 +1504,6 @@ async def test_group_get(app):
|
||||
}
|
||||
|
||||
|
||||
@mark.group
|
||||
async def test_group_user_pagination(app):
|
||||
group = orm.Group.find(app.db, name='betaflight')
|
||||
user = add_user(app.db, app=app, name='bigfoot')
|
||||
second_user = add_user(app.db, app=app, name='birdman')
|
||||
group.users.append(user)
|
||||
group.users.append(second_user)
|
||||
app.db.commit()
|
||||
|
||||
# Test offset for pagination
|
||||
r = await api_request(app, 'groups/betaflight?offset=1')
|
||||
r.raise_for_status()
|
||||
reply = r.json()
|
||||
assert reply == {'kind': 'group', 'name': 'betaflight', 'users': ['birdman']}
|
||||
|
||||
r = await api_request(app, 'groups/betaflight?offset=10')
|
||||
r.raise_for_status()
|
||||
assert r.json() == {'kind': 'group', 'name': 'betaflight', 'users': []}
|
||||
|
||||
# Test limit for pagination
|
||||
r = await api_request(app, 'groups/betaflight?limit=1')
|
||||
r.raise_for_status()
|
||||
reply = r.json()
|
||||
assert reply == {'kind': 'group', 'name': 'betaflight', 'users': ['bigfoot']}
|
||||
|
||||
r = await api_request(app, 'groups/betaflight?limit=0')
|
||||
r.raise_for_status()
|
||||
assert r.json() == {'kind': 'group', 'name': 'betaflight', 'users': []}
|
||||
|
||||
|
||||
@mark.group
|
||||
async def test_group_create_delete(app):
|
||||
db = app.db
|
||||
|
Reference in New Issue
Block a user