#NEWLINE# def test_header_login( self ) : #NEWLINE# #INDENT# role = self . create_user ( ) #NEWLINE# db . session . refresh ( role ) #NEWLINE# headers = { #NEWLINE# #INDENT# 'Authorization' : 'apikey foo' , #NEWLINE# #UNINDENT# } #NEWLINE# res = self . client . get ( '/api/1/sessions' , headers = headers ) #NEWLINE# assert ( not res . json . get ( 'logged_in' ) ) , res . json #NEWLINE# assert ( not res . json . get ( 'user' ) ) , res . json #NEWLINE# headers = { #NEWLINE# #INDENT# 'Authorization' : ( 'apikey %s' % role . api_key ) , #NEWLINE# #UNINDENT# } #NEWLINE# res = self . client . get ( '/api/1/sessions' , headers = headers ) #NEWLINE# assert res . json . get ( 'logged_in' ) , res . json #NEWLINE# assert ( res . json [ 'role' ] [ 'id' ] == role . id ) , res . json