#NEWLINE# def testGet302NoLocation( self ) : #NEWLINE# #INDENT# self . http . force_exception_to_status_code = False #NEWLINE# uri = urllib . parse . urljoin ( base , '302/no-location.asis' ) #NEWLINE# try : #NEWLINE# #INDENT# ( response , content ) = self . http . request ( uri , 'GET' ) #NEWLINE# self . fail ( 'Should never reach here' ) #NEWLINE# #UNINDENT# except httplib2 . RedirectMissingLocation : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# except Exception as e : #NEWLINE# #INDENT# self . fail ( 'Threw wrong kind of exception ' ) #NEWLINE# #UNINDENT# self . http . force_exception_to_status_code = True #NEWLINE# ( response , content ) = self . http . request ( uri , 'GET' ) #NEWLINE# self . assertEqual ( response . status , 500 ) #NEWLINE# self . assertTrue ( response . reason . startswith ( 'Redirected but' ) ) #NEWLINE# self . assertEqual ( '302' , response [ 'status' ] ) #NEWLINE# self . assertTrue ( content . startswith ( b'This is content' ) )