Пример #1
0
def test_expire():
    tt = TempToken('token_key', 1)
    data = {'key': 'value'}

    assert tt.decode(tt.encode(**data)) == data

    token = tt.encode(**data)
    time.sleep(2)
    pytest.raises(ExpiredToken, tt.decode, token)
Пример #2
0
def test_basics():
    tt = TempToken('token_key', None)
    data = {'a': 1}
    assert tt.decode(tt.encode(**data)) == data