#NEWLINE# @ mock . patch ( 'statsd.Connection' ) #NEWLINE# @ mock . patch ( 'statsd.Gauge' ) #NEWLINE# def test_statsd_setup_defaults( self , mock_gauge , mock_connection ) : #NEWLINE# #INDENT# 'Test setup with defaults.' #NEWLINE# config = { #NEWLINE# #INDENT# 'statsd' : { #NEWLINE# #INDENT# 'host' : 'host' , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } #NEWLINE# hass = mock . MagicMock ( ) #NEWLINE# self . assertTrue ( statsd . setup ( hass , config ) ) #NEWLINE# mock_connection . assert_called_once_with ( host = 'host' , port = statsd . DEFAULT_PORT , sample_rate = statsd . DEFAULT_RATE , disabled = False ) #NEWLINE# mock_gauge . assert_called_once_with ( statsd . DEFAULT_PREFIX , mock_connection . return_value ) #NEWLINE# self . assertTrue ( hass . bus . listen . called )