Allow expired app specific tokens to be deleted
This commit is contained in:
parent
b29e8202e5
commit
208dc38d25
3 changed files with 25 additions and 3 deletions
|
@ -1,3 +1,6 @@
|
|||
from datetime import datetime, timedelta
|
||||
|
||||
from data import model
|
||||
from endpoints.api.appspecifictokens import AppTokens, AppToken
|
||||
from endpoints.api.test.shared import conduct_api_call
|
||||
from endpoints.test.shared import client_with_identity
|
||||
|
@ -35,3 +38,13 @@ def test_app_specific_tokens(app, client):
|
|||
assert token_uuid not in set([token['uuid'] for token in resp['tokens']])
|
||||
|
||||
conduct_api_call(cl, AppToken, 'GET', {'token_uuid': token_uuid}, None, 404)
|
||||
|
||||
|
||||
def test_delete_expired_app_token(app, client):
|
||||
user = model.user.get_user('devtable')
|
||||
expiration = datetime.now() - timedelta(seconds=10)
|
||||
token = model.appspecifictoken.create_token(user, 'some token', expiration)
|
||||
|
||||
with client_with_identity('devtable', client) as cl:
|
||||
# Delete the token.
|
||||
conduct_api_call(cl, AppToken, 'DELETE', {'token_uuid': token.uuid}, None, 204)
|
||||
|
|
Reference in a new issue