#NEWLINE# def test_get_token_by_username( self ) : #NEWLINE# #INDENT# self . _set_user_settings ( ) #NEWLINE# token_backend = InMemoryTokenBackend ( ) #NEWLINE# user_model = UserSQLiteModel ( ) #NEWLINE# user = self . _create_simple_user ( user_model ) #NEWLINE# token_data = { #NEWLINE# #INDENT# 'name' : 'api' , #NEWLINE# 'token' : 'my_test_token' , #NEWLINE# 'user_id' : user . id , #NEWLINE# #UNINDENT# } #NEWLINE# token_backend . save ( token_data [ 'name' ] , token_data [ 'token' ] , user_id = token_data [ 'user_id' ] ) #NEWLINE# db_token = token_backend . get_token_by_username ( 'api' , user . username ) #NEWLINE# self . assertEqual ( db_token [ 'name' ] , token_data [ 'name' ] ) #NEWLINE# self . assertEqual ( db_token [ 'token' ] , token_data [ 'token' ] ) #NEWLINE# self . assertEqual ( db_token [ 'user_id' ] , token_data [ 'user_id' ] )