#NEWLINE# def test_authenticate_with_password( ) : #NEWLINE# #INDENT# db = SQLAlchemy ( 'sqlite:///:memory:' ) #NEWLINE# auth = authcode . Auth ( SECRET_KEY , db = User ) #NEWLINE# User = auth . User #NEWLINE# db . create_all ( ) #NEWLINE# credentials = { #NEWLINE# #INDENT# 'login' : 'meh' , #NEWLINE# 'password' : 'foobar' , #NEWLINE# #UNINDENT# } #NEWLINE# user = User ( ** credentials ) #NEWLINE# db . session . add ( user ) #NEWLINE# db . session . commit ( ) #NEWLINE# auth_user = auth . authenticate ( credentials ) #NEWLINE# assert ( user . login == auth_user . login ) #NEWLINE# auth_user = auth . authenticate ( { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ) #NEWLINE# assert ( not auth_user ) #NEWLINE# auth_user = auth . authenticate ( { #NEWLINE# #INDENT# 'login' : 'meh' , #NEWLINE# #UNINDENT# } ) #NEWLINE# assert ( not auth_user ) #NEWLINE# auth_user = auth . authenticate ( { #NEWLINE# #INDENT# 'login' : 'wtf' , #NEWLINE# 'password' : 'foobar' , #NEWLINE# #UNINDENT# } ) #NEWLINE# assert ( not auth_user ) #NEWLINE# auth_user = auth . authenticate ( { #NEWLINE# #INDENT# 'login' : 'meh' , #NEWLINE# 'password' : 'lalala' , #NEWLINE# #UNINDENT# } ) #NEWLINE# assert ( not auth_user )