#NEWLINE# def test_basic_auth_login_invalid( self ) : #NEWLINE# #INDENT# creds = base64 . b64encode ( b'john:bye' ) . decode ( 'utf-8' ) #NEWLINE# response = self . client . get ( '/basic' , headers = { #NEWLINE# #INDENT# 'Authorization' : ( 'Basic ' + self ) , #NEWLINE# #UNINDENT# } ) #NEWLINE# self . assertEqual ( response . status_code , 401 ) #NEWLINE# self . assertTrue ( ( 'WWW-Authenticate' in response . headers ) ) #NEWLINE# self . assertEqual ( response . headers [ 'WWW-Authenticate' ] , 'Basic realm="Authentication Required"' )