#NEWLINE# @ patch . object ( Collector , 'publish' ) #NEWLINE# def test_should_work_wtih_real_data( self , publish_mock ) : #NEWLINE# #INDENT# ntpdate_data = Mock ( return_value = ( self . getFixture ( 'ntpdate' ) . getvalue ( ) , None ) ) #NEWLINE# collector_mock = patch . object ( NtpCollector , 'run_command' , ntpdate_data ) #NEWLINE# collector_mock . start ( ) #NEWLINE# self . collector . collect ( ) #NEWLINE# collector_mock . stop ( ) #NEWLINE# metrics = { #NEWLINE# #INDENT# 'server.count' : 4 , #NEWLINE# 'offset.milliseconds' : 0 , #NEWLINE# #UNINDENT# } #NEWLINE# self . setDocExample ( collector = self . collector . __class__ . __name__ , metrics = metrics , defaultpath = self . collector . config [ 'path' ] ) #NEWLINE# self . assertPublishedMany ( publish_mock , metrics )