@@ -91,44 +91,42 @@ def test_trace_explicit(self):
9191 def test_patch_traces_default (self ):
9292 from google .cloud .trace ._gax import _TraceAPI
9393
94- def patch_traces (traces , project_id = None , options = None ):
95- _patch_traces_called_with = (traces , project_id , options )
96- return _patch_traces_called_with
97-
9894 credentials = _make_credentials ()
9995 client = self ._make_one (project = self .project , credentials = credentials )
10096 traces = 'fake_traces_for_test'
10197
10298 mock_trace_api = mock .Mock (spec = _TraceAPI )
103- mock_trace_api .patch_traces = patch_traces
99+ mock_trace_api .patch_traces = mock . Mock ()
104100 patch = mock .patch ('google.cloud.trace.client.make_gax_trace_api' , return_value = mock_trace_api )
105101
106102 with patch :
107- patch_traces_called_with = client .patch_traces (traces = traces )
103+ client .patch_traces (traces = traces )
108104
109- self .assertEqual (patch_traces_called_with , (traces , self .project , None ))
105+ mock_trace_api .patch_traces .assert_called_with (
106+ options = None ,
107+ project_id = 'PROJECT' ,
108+ traces = 'fake_traces_for_test' )
110109
111110 def test_patch_traces_explicit (self ):
112111 from google .cloud .trace ._gax import _TraceAPI
113112
114- def patch_traces (traces , project_id = None , options = None ):
115- _patch_traces_called_with = (traces , project_id , options )
116- return _patch_traces_called_with
117-
118113 credentials = _make_credentials ()
119114 client = self ._make_one (project = self .project , credentials = credentials )
120115 traces = 'fake_traces_for_test'
121116
122117 mock_trace_api = mock .Mock (spec = _TraceAPI )
123- mock_trace_api .patch_traces = patch_traces
118+ mock_trace_api .patch_traces = mock . Mock ()
124119 patch = mock .patch ('google.cloud.trace.client.make_gax_trace_api' , return_value = mock_trace_api )
125120
126121 with patch :
127- patch_traces_called_with = client .patch_traces (
122+ client .patch_traces (
128123 project_id = self .project ,
129124 traces = traces )
130125
131- self .assertEqual (patch_traces_called_with , (traces , self .project , None ))
126+ mock_trace_api .patch_traces .assert_called_with (
127+ options = None ,
128+ project_id = 'PROJECT' ,
129+ traces = 'fake_traces_for_test' )
132130
133131 def test_get_trace_default (self ):
134132 from google .cloud .trace ._gax import _TraceAPI
0 commit comments