#NEWLINE# @ patch . dict ( 'pyon.net.endpoint.CFG' , { #NEWLINE# #INDENT# 'container' : { #NEWLINE# #INDENT# 'sflow' : { #NEWLINE# #INDENT# 'enabled' : True , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } ) #NEWLINE# @ patch ( 'pyon.net.endpoint.log' ) #NEWLINE# def test__sample_request_no_sample( self , mocklog ) : #NEWLINE# #INDENT# e = RPCResponseEndpointUnit ( interceptors = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ) #NEWLINE# e . _get_sflow_manager = Mock ( return_value = Mock ( spec = SFlowManager ) ) #NEWLINE# e . _get_sflow_manager . return_value . should_sample = False #NEWLINE# e . _get_sample_name = Mock ( ) #NEWLINE# e . _sample_request ( sentinel . status , sentinel . status_descr , sentinel . msg , sentinel . headers , sentinel . response , sentinel . response_headers ) #NEWLINE# self . assertEquals ( mocklog . debug . call_count , 1 ) #NEWLINE# self . assertIn ( 'not to sample' , mocklog . debug . call_args [ 0 ] [ 0 ] )