#NEWLINE# @ patch . object ( Collector , 'publish' ) #NEWLINE# def test_should_work_with_real_data( self , publish_mock ) : #NEWLINE# #INDENT# def se( url ) : #NEWLINE# #INDENT# if ( url == 'http://localhost:8081/vars' ) : #NEWLINE# #INDENT# return self . getFixture ( 'metrics' ) #NEWLINE# #UNINDENT# #UNINDENT# patch_urlopen = patch ( 'urllib2.urlopen' , Mock ( side_effect = metrics ) ) #NEWLINE# patch_urlopen . start ( ) #NEWLINE# self . collector . collect ( ) #NEWLINE# patch_urlopen . stop ( ) #NEWLINE# metrics = self . get_metrics ( ) #NEWLINE# self . setDocExample ( collector = self . collector . __class__ . __name__ , metrics = metrics , defaultpath = self . collector . config [ 'path' ] ) #NEWLINE# self . assertPublishedMany ( publish_mock , metrics )