@@ -39,16 +39,20 @@ def test_constructor_cloud(self):
3939 from opencensus .trace .ext .django import middleware
4040 from opencensus .trace .samplers import always_on
4141 from opencensus .trace .propagation import google_cloud_format
42+ from opencensus .trace .exporters .transports import sync
4243
4344 class MockCloudExporter (object ):
44- def __init__ (self , project_id ):
45+ def __init__ (self , project_id , transport ):
4546 self .project_id = project_id
47+ self .transport = transport
4648
4749 MockCloudExporter .__name__ = 'GoogleCloudExporter'
4850
4951 project_id = 'my_project'
5052 params = {
5153 'GCP_EXPORTER_PROJECT' : project_id ,
54+ 'TRANSPORT' :
55+ 'opencensus.trace.exporters.transports.sync.SyncTransport' ,
5256 }
5357
5458 patch_params = mock .patch (
@@ -75,6 +79,7 @@ def __init__(self, project_id):
7579 google_cloud_format .GoogleCloudFormatPropagator )
7680
7781 self .assertEqual (middleware .exporter .project_id , project_id )
82+ self .assertEqual (middleware .exporter .transport , sync .SyncTransport )
7883
7984 def test_constructor_zipkin (self ):
8085 from opencensus .trace .ext .django import middleware
@@ -89,6 +94,8 @@ def test_constructor_zipkin(self):
8994 'ZIPKIN_EXPORTER_SERVICE_NAME' : service_name ,
9095 'ZIPKIN_EXPORTER_HOST_NAME' : host_name ,
9196 'ZIPKIN_EXPORTER_PORT' : port ,
97+ 'TRANSPORT' :
98+ 'opencensus.trace.exporters.transports.sync.SyncTransport' ,
9299 }
93100
94101 patch_zipkin = mock .patch (
@@ -129,6 +136,8 @@ def test_constructor_probability_sampler(self):
129136 rate = 0.8
130137 params = {
131138 'SAMPLING_RATE' : 0.8 ,
139+ 'TRANSPORT' :
140+ 'opencensus.trace.exporters.transports.sync.SyncTransport' ,
132141 }
133142
134143 patch_sampler = mock .patch (
@@ -210,7 +219,10 @@ def test_blacklist_path(self):
210219 execution_context .clear ()
211220
212221 blacklist_paths = ['test_blacklist_path' ,]
213- params = {'BLACKLIST_PATHS' : ['test_blacklist_path' ,]}
222+ params = {
223+ 'BLACKLIST_PATHS' : ['test_blacklist_path' ,],
224+ 'TRANSPORT' :
225+ 'opencensus.trace.exporters.transports.sync.SyncTransport' ,}
214226 patch_params = mock .patch (
215227 'opencensus.trace.ext.django.middleware.settings.params' ,
216228 params )
0 commit comments