#NEWLINE# def testProcessRequestReturnsHttpResponse400WhenPostDataConversionFails( self ) : #NEWLINE# #INDENT# def raiseException( ) : #NEWLINE# #INDENT# raise #NEWLINE# #UNINDENT# self . dynamicformat . _flatten_dict = Mock ( side_effect = result ) #NEWLINE# self . request . META [ 'CONTENT_TYPE' ] = 'application/json' #NEWLINE# self . request . META [ 'CONTENT_LENGTH' ] = 1 #NEWLINE# result = self . dynamicformat . process_request ( self . request ) #NEWLINE# self . assertTrue ( isinstance ( result , HttpResponse ) , 'should return instance of HttpResponse' ) #NEWLINE# self . assertEqual ( result . status_code , 400 )