#NEWLINE# def test_fallback_gracefully( self ) : #NEWLINE# #INDENT# from rest_framework.filters import DjangoFilterBackend , OrderingFilter #NEWLINE# from rest_framework.settings import api_settings #NEWLINE# api_settings . DEFAULT_FILTER_BACKENDS = ( DjangoFilterBackend , OrderingFilter ) #NEWLINE# with mock . patch . object ( es_client , 'search' ) as mock_search : #NEWLINE# #INDENT# mock_search . side_effect = TransportError ( ) #NEWLINE# with mock . patch . object ( es_client , 'count' ) as mock_count : #NEWLINE# #INDENT# mock_count . side_effect = TransportError ( ) #NEWLINE# with mock . patch . object ( es_client , 'get' ) as mock_get : #NEWLINE# #INDENT# mock_get . side_effect = TransportError ( ) #NEWLINE# r = self . client . get ( '/rf/tests/' ) #NEWLINE# self . assertEqual ( r . status_code , 200 ) #NEWLINE# self . assertEqual ( r . data [ 'filter_status' ] , 'Failed' ) #NEWLINE# self . assertEqual ( mock_count . data [ 'count' ] , 3 ) #NEWLINE# self . _test_filter_backend_filters ( ) #NEWLINE# self . _test_pagination ( )