@@ -21,20 +21,20 @@ def setUp(self):
2121 def tearDown (self ):
2222 super (TestInfluxReporter , self ).tearDown ()
2323
24- def test_report_now (self ):
24+ def test_not_called_on_blank (self ):
2525 influx_reporter = InfluxReporter (registry = self .registry )
2626
2727 with mock .patch ("pyformance.reporters.influx.urlopen" ) as patch :
2828 influx_reporter .report_now ()
29- patch .assert_called ()
29+ patch .assert_not_called ()
3030
3131 def test_create_database (self ):
3232 r1 = InfluxReporter (registry = self .registry , autocreate_database = True )
3333 with mock .patch ("pyformance.reporters.influx.urlopen" ) as patch :
3434 r1 .report_now ()
35- if patch .call_count != 2 :
35+ if patch .call_count != 1 :
3636 raise AssertionError (
37- "Expected 2 calls to 'urlopen'. Received: {}" .format (
37+ "Expected 1 calls to 'urlopen'. Received: {}" .format (
3838 patch .call_count
3939 )
4040 )
@@ -47,8 +47,7 @@ def test_gauge_without_tags(self):
4747 autocreate_database = False
4848 )
4949
50- with mock .patch .object (influx_reporter , "_try_send" ,
51- wraps = influx_reporter ._try_send ) as send_mock :
50+ with mock .patch .object (influx_reporter , "_try_send" ) as send_mock :
5251 influx_reporter .report_now ()
5352
5453 expected_url = "http://127.0.0.1:8086/write?db=metrics&precision=s"
@@ -64,8 +63,7 @@ def test_gauge_with_tags(self):
6463 autocreate_database = False
6564 )
6665
67- with mock .patch .object (influx_reporter , "_try_send" ,
68- wraps = influx_reporter ._try_send ) as send_mock :
66+ with mock .patch .object (influx_reporter , "_try_send" ) as send_mock :
6967 influx_reporter .report_now ()
7068
7169 expected_url = "http://127.0.0.1:8086/write?db=metrics&precision=s"
@@ -83,8 +81,7 @@ def test_gauge_with_global_tags(self):
8381 global_tags = {"stage" : "dev" , "region" : "override" }
8482 )
8583
86- with mock .patch .object (influx_reporter , "_try_send" ,
87- wraps = influx_reporter ._try_send ) as send_mock :
84+ with mock .patch .object (influx_reporter , "_try_send" ) as send_mock :
8885 influx_reporter .report_now ()
8986
9087 expected_url = "http://127.0.0.1:8086/write?db=metrics&precision=s"
@@ -105,8 +102,7 @@ def test_counter_with_tags(self):
105102 autocreate_database = False
106103 )
107104
108- with mock .patch .object (influx_reporter , "_try_send" ,
109- wraps = influx_reporter ._try_send ) as send_mock :
105+ with mock .patch .object (influx_reporter , "_try_send" ) as send_mock :
110106 influx_reporter .report_now ()
111107
112108 expected_url = "http://127.0.0.1:8086/write?db=metrics&precision=s"
@@ -127,8 +123,7 @@ def test_events_with_tags(self):
127123 autocreate_database = False
128124 )
129125
130- with mock .patch .object (influx_reporter , "_try_send" ,
131- wraps = influx_reporter ._try_send ) as send_mock :
126+ with mock .patch .object (influx_reporter , "_try_send" ) as send_mock :
132127 influx_reporter .report_now ()
133128
134129 expected_url = "http://127.0.0.1:8086/write?db=metrics&precision=s"
@@ -152,8 +147,7 @@ def test_combined_events_with_counter(self):
152147 autocreate_database = False
153148 )
154149
155- with mock .patch .object (influx_reporter , "_try_send" ,
156- wraps = influx_reporter ._try_send ) as send_mock :
150+ with mock .patch .object (influx_reporter , "_try_send" ) as send_mock :
157151 influx_reporter .report_now ()
158152
159153 expected_url = "http://127.0.0.1:8086/write?db=metrics&precision=s"
@@ -177,8 +171,7 @@ def test_count_calls_with_tags(self):
177171 autocreate_database = False
178172 )
179173
180- with mock .patch .object (influx_reporter , "_try_send" ,
181- wraps = influx_reporter ._try_send ) as send_mock :
174+ with mock .patch .object (influx_reporter , "_try_send" ) as send_mock :
182175 influx_reporter .report_now ()
183176
184177 expected_url = "http://127.0.0.1:8086/write?db=metrics&precision=s"
0 commit comments