#NEWLINE# @ with_ioloop #NEWLINE# @ with_couchdb #NEWLINE# def test_update_user( baseurl , ioloop ) : #NEWLINE# #INDENT# s = trombi . Server ( userdoc , io_loop = ioloop ) #NEWLINE# userdoc = [ ] #NEWLINE# def add_callback( doc ) : #NEWLINE# #INDENT# assert ( not doc . error ) #NEWLINE# userdoc . append ( doc ) #NEWLINE# ioloop . stop ( ) #NEWLINE# #UNINDENT# s . add_user ( 'updatetest' , 'test' , add_callback ) #NEWLINE# ioloop . start ( ) #NEWLINE# def update_callback( doc ) : #NEWLINE# #INDENT# assert ( not doc . error ) #NEWLINE# userdoc . append ( doc ) #NEWLINE# ioloop . stop ( ) #NEWLINE# #UNINDENT# userdoc [ 0 ] [ 'roles' ] . append ( 'test' ) #NEWLINE# s . update_user ( userdoc [ 0 ] , update_callback ) #NEWLINE# ioloop . start ( ) #NEWLINE# eq ( userdoc [ 1 ] [ 'roles' ] , [ 'test' ] ) #NEWLINE# def update_passwd_callback( doc ) : #NEWLINE# #INDENT# assert ( not doc . error ) #NEWLINE# userdoc . append ( doc ) #NEWLINE# ioloop . stop ( ) #NEWLINE# #UNINDENT# s . update_user_password ( 'updatetest' , 'test2' , update_passwd_callback ) #NEWLINE# ioloop . start ( ) #NEWLINE# eq ( userdoc [ 1 ] [ 'salt' ] , userdoc [ 2 ] [ 'salt' ] ) #NEWLINE# eq ( ( userdoc [ 1 ] [ 'password_sha' ] != userdoc [ 2 ] [ 'password_sha' ] ) , True )