@@ -106,14 +106,18 @@ def test_create_build_without_wait(self, get_conn, mock_get_id_from_operation):
106
106
107
107
self .hook .create_build (build = BUILD , project_id = PROJECT_ID , wait = False )
108
108
109
- get_conn .return_value .create_build .assert_called_once_with (
109
+ mock_operation = get_conn .return_value .create_build
110
+
111
+ mock_operation .assert_called_once_with (
110
112
request = {'project_id' : PROJECT_ID , 'build' : BUILD }, retry = None , timeout = None , metadata = ()
111
113
)
112
114
113
115
get_conn .return_value .get_build .assert_called_once_with (
114
116
request = {'project_id' : PROJECT_ID , 'id' : BUILD_ID }, retry = None , timeout = None , metadata = ()
115
117
)
116
118
119
+ mock_get_id_from_operation .assert_called_once_with (mock_operation ())
120
+
117
121
@patch ("airflow.providers.google.cloud.hooks.cloud_build.CloudBuildHook.get_conn" )
118
122
def test_create_build_trigger (self , get_conn ):
119
123
self .hook .create_build_trigger (trigger = BUILD_TRIGGER , project_id = PROJECT_ID )
@@ -194,7 +198,9 @@ def test_retry_build_with_wait(self, get_conn, wait_time, mock_get_id_from_opera
194
198
195
199
self .hook .retry_build (id_ = BUILD_ID , project_id = PROJECT_ID )
196
200
197
- get_conn .return_value .retry_build .assert_called_once_with (
201
+ mock_operation = get_conn .return_value .retry_build
202
+
203
+ mock_operation .assert_called_once_with (
198
204
request = {'project_id' : PROJECT_ID , 'id' : BUILD_ID }, retry = None , timeout = None , metadata = ()
199
205
)
200
206
@@ -204,6 +210,8 @@ def test_retry_build_with_wait(self, get_conn, wait_time, mock_get_id_from_opera
204
210
request = {'project_id' : PROJECT_ID , 'id' : BUILD_ID }, retry = None , timeout = None , metadata = ()
205
211
)
206
212
213
+ mock_get_id_from_operation .assert_called_once_with (mock_operation ())
214
+
207
215
@patch ("airflow.providers.google.cloud.hooks.cloud_build.CloudBuildHook._get_build_id_from_operation" )
208
216
@patch ("airflow.providers.google.cloud.hooks.cloud_build.CloudBuildHook.get_conn" )
209
217
def test_retry_build_without_wait (self , get_conn , mock_get_id_from_operation ):
@@ -233,7 +241,9 @@ def test_run_build_trigger_with_wait(self, get_conn, wait_time, mock_get_id_from
233
241
trigger_id = TRIGGER_ID , source = REPO_SOURCE ['repo_source' ], project_id = PROJECT_ID
234
242
)
235
243
236
- get_conn .return_value .run_build_trigger .assert_called_once_with (
244
+ mock_operation = get_conn .return_value .run_build_trigger
245
+
246
+ mock_operation .assert_called_once_with (
237
247
request = {
238
248
'project_id' : PROJECT_ID ,
239
249
'trigger_id' : TRIGGER_ID ,
@@ -250,6 +260,8 @@ def test_run_build_trigger_with_wait(self, get_conn, wait_time, mock_get_id_from
250
260
request = {'project_id' : PROJECT_ID , 'id' : BUILD_ID }, retry = None , timeout = None , metadata = ()
251
261
)
252
262
263
+ mock_get_id_from_operation .assert_called_once_with (mock_operation ())
264
+
253
265
@patch ("airflow.providers.google.cloud.hooks.cloud_build.CloudBuildHook._get_build_id_from_operation" )
254
266
@patch ("airflow.providers.google.cloud.hooks.cloud_build.CloudBuildHook.get_conn" )
255
267
def test_run_build_trigger_without_wait (self , get_conn , mock_get_id_from_operation ):
0 commit comments