#NEWLINE# @ patch . object ( Collector , 'flush' ) #NEWLINE# def test_should_create_type( self , publish_mock ) : #NEWLINE# #INDENT# self . collector . list_request = list_request #NEWLINE# def se( url ) : #NEWLINE# #INDENT# return self . getFixture ( 'metrics.json' ) #NEWLINE# #UNINDENT# patch_urlopen = patch ( 'urllib2.urlopen' , Mock ( side_effect = se ) ) #NEWLINE# with patch_urlopen : #NEWLINE# #INDENT# self . collector . collect ( ) #NEWLINE# #UNINDENT# self . assertEquals ( len ( self . collector . payload ) , 3827 ) #NEWLINE# metrics = find_metric ( metric . collector . payload , 'org.apache.cassandra.metrics.ColumnFamily.CoordinatorReadLatency.count' ) #NEWLINE# self . assertNotEqual ( len ( metrics ) , 0 ) #NEWLINE# metric = find_by_dimension ( metrics , 'keyspace' , 'OpsCenter' ) #NEWLINE# self . assertEquals ( metric [ 'type' ] , 'CUMCOUNTER' )