Add a worker to automatically GC expired app specific tokens

Fixes https://jira.coreos.com/browse/QUAY-822
This commit is contained in:
Joseph Schorr 2018-02-12 14:56:01 -05:00
parent 06d25816be
commit d45161b120
7 changed files with 77 additions and 5 deletions

View file

@ -1,4 +1,4 @@
from datetime import datetime
from datetime import datetime, timedelta
from mock import patch
import pytest
@ -36,7 +36,7 @@ def test_gc(expiration, initialized_db):
token = create_token(user, 'Some token', expiration=expiration_date)
# GC tokens.
gc_expired_tokens(user)
gc_expired_tokens(timedelta(seconds=0))
# Ensure the token was GCed if expired and not if it wasn't.
assert (access_valid_token(token.token_code) is None) == is_expired