mirror of
https://github.com/wassname/flask-security.git
synced 2026-09-09 11:22:35 +08:00
Convert all tests to use pytest. Phew!
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
test_trackable
|
||||
~~~~~~~~~~~~~~
|
||||
|
||||
Trackable tests
|
||||
"""
|
||||
|
||||
from utils import authenticate, logout, init_app_with_options
|
||||
|
||||
|
||||
def test_trackable_flag(app, sqlalchemy_datastore):
|
||||
init_app_with_options(app, sqlalchemy_datastore, **{
|
||||
'SECURITY_TRACKABLE': True
|
||||
})
|
||||
|
||||
client = app.test_client()
|
||||
|
||||
e = 'matt@lp.com'
|
||||
authenticate(client, email=e)
|
||||
logout(client)
|
||||
authenticate(client, email=e)
|
||||
|
||||
with app.app_context():
|
||||
user = app.security.datastore.find_user(email=e)
|
||||
assert user.last_login_at is not None
|
||||
assert user.current_login_at is not None
|
||||
assert user.last_login_ip == 'untrackable'
|
||||
assert user.current_login_ip == 'untrackable'
|
||||
assert user.login_count == 2
|
||||
Reference in New Issue
Block a user