token expiry fixes

typos in token expiry:

- omitted from token model (it's in the spec in docs, but wasn't in the model)
- wrong type when sorting oauth tokens on token page could cause token page to not render
This commit is contained in:
Min RK
2018-09-10 16:01:41 +02:00
parent 3360817cb6
commit 06f646099f
4 changed files with 54 additions and 9 deletions

View File

@@ -598,6 +598,29 @@ def test_announcements(app, announcements):
assert_announcement("logout", r.text)
@pytest.mark.gen_test
def test_token_page(app):
name = "cake"
cookies = yield app.login_user(name)
r = yield get_page("token", app, cookies=cookies)
r.raise_for_status()
assert urlparse(r.url).path.endswith('/hub/token')
assert "Request new API token" in r.text
assert "API Tokens" in r.text
assert "Server at %s" % app.users[name].url in r.text
# no oauth tokens yet, shouldn't have that section
assert "Authorized Applications" not in r.text
# spawn the user to trigger oauth, etc.
r = yield get_page("spawn", app, cookies=cookies)
r.raise_fo_status()
r = yield get_page("token", app, cookies=cookies)
r.raise_for_status()
assert "API Tokens" in r.text
assert "Authorized Applications" not in r.text
@pytest.mark.gen_test
def test_server_not_running_api_request(app):
cookies = yield app.login_user("bees")