@@ -115,7 +115,7 @@ def test_create_metadata_item_rule(self, mock_add_metadata_rule):
115
115
116
116
@patch .object (clone_metadata_utils , 'create_metadata_items' )
117
117
@patch .object (clone_metadata_utils , 'list_metadata_items' )
118
- @patch ('cloudinary_cli.utils.utils.confirm_action ' )
118
+ @patch ('builtins.input' , return_value = 'true ' )
119
119
def test_compare_create_metadata_items_new_fields (self ,mock_confirm , mock_list , mock_create , ):
120
120
"""Test comparing and creating new metadata fields"""
121
121
metadata_fields = {
@@ -132,15 +132,15 @@ def test_compare_create_metadata_items_new_fields(self,mock_confirm, mock_list,
132
132
}
133
133
]
134
134
}
135
- mock_confirm . return_value = True
135
+
136
136
mock_source_fields = metadata_fields
137
137
mock_list .return_value = metadata_fields
138
138
mock_destination_fields = {
139
139
'metadata_fields' : []
140
140
}
141
141
142
142
clone_metadata_utils .compare_create_metadata_items (mock_source_fields , mock_destination_fields , key = "metadata_fields" , ** self .mock_target_config )
143
- mock_confirm . return_value = True
143
+
144
144
# Both fields should be created
145
145
self .assertEqual (mock_create .call_count , 2 )
146
146
mock_create .assert_any_call ('add_metadata_field' , mock_source_fields ['metadata_fields' ][0 ], ** self .mock_target_config )
@@ -152,7 +152,7 @@ def test_compare_create_metadata_items_new_fields(self,mock_confirm, mock_list,
152
152
153
153
@patch .object (clone_metadata_utils , 'create_metadata_items' )
154
154
@patch .object (clone_metadata_utils , 'list_metadata_items' )
155
- @patch ('cloudinary_cli.utils.utils.confirm_action ' )
155
+ @patch ('builtins.input' , return_value = 'true ' )
156
156
def test_compare_create_metadata_items_new_rules (self , mock_list , mock_create , mock_confirm ):
157
157
"""Test comparing and creating new metadata rules"""
158
158
metadata_rules = {
@@ -177,7 +177,7 @@ def test_compare_create_metadata_items_new_rules(self, mock_list, mock_create, m
177
177
}
178
178
]
179
179
}
180
- mock_confirm . return_value = True
180
+
181
181
mock_source_metadata_rules = metadata_rules
182
182
mock_list .return_value = metadata_rules
183
183
@@ -196,7 +196,7 @@ def test_compare_create_metadata_items_new_rules(self, mock_list, mock_create, m
196
196
self .assertEqual (result , mock_list .return_value )
197
197
198
198
@patch .object (clone_metadata_utils , 'create_metadata_items' )
199
- @patch ('cloudinary_cli.utils.utils.confirm_action ' )
199
+ @patch ('builtins.input' , return_value = 'true ' )
200
200
def test_compare_create_metadata_items_existing_fields (self , mock_create , mock_confirm ):
201
201
"""Test comparing when fields already exist"""
202
202
mock_source_fields = {
@@ -219,14 +219,14 @@ def test_compare_create_metadata_items_existing_fields(self, mock_create, mock_c
219
219
}
220
220
]
221
221
}
222
- mock_confirm . return_value = True
222
+
223
223
clone_metadata_utils .compare_create_metadata_items (mock_source_fields , mock_destination_fields , key = "metadata_fields" , ** self .mock_target_config )
224
224
225
225
# No fields should be created
226
226
mock_create .assert_not_called ()
227
227
228
228
@patch .object (clone_metadata_utils , 'create_metadata_items' )
229
- @patch ('cloudinary_cli.utils.utils.confirm_action ' )
229
+ @patch ('builtins.input' , return_value = 'true ' )
230
230
def test_compare_create_metadata_items_existing_rules (self , mock_create , mock_confirm ):
231
231
"""Test comparing when rules already exist"""
232
232
@@ -258,15 +258,15 @@ def test_compare_create_metadata_items_existing_rules(self, mock_create, mock_co
258
258
}
259
259
]
260
260
}
261
- mock_confirm . return_value = True
261
+
262
262
clone_metadata_utils .compare_create_metadata_items (mock_source_metadata_rules , mock_destination_metadata_rules , key = "metadata_rules" , ** self .mock_target_config )
263
263
264
264
# No rules should be created
265
265
mock_create .assert_not_called ()
266
266
267
267
@patch .object (clone_metadata_utils , 'create_metadata_items' )
268
268
@patch .object (clone_metadata_utils , 'list_metadata_items' )
269
- @patch ('cloudinary_cli.utils.utils.confirm_action ' )
269
+ @patch ('builtins.input' , return_value = 'true ' )
270
270
def test_compare_create_metadata_items_mixed_scenario (self , mock_list , mock_create , mock_confirm ):
271
271
"""Test comparing with mix of new and existing fields"""
272
272
metadata_fields = {
@@ -294,7 +294,7 @@ def test_compare_create_metadata_items_mixed_scenario(self, mock_list, mock_crea
294
294
}
295
295
]
296
296
}
297
- mock_confirm . return_value = True
297
+
298
298
mock_source_fields = metadata_fields
299
299
mock_list .return_value = metadata_fields
300
300
@@ -309,7 +309,7 @@ def test_compare_create_metadata_items_mixed_scenario(self, mock_list, mock_crea
309
309
310
310
@patch .object (clone_metadata_utils , 'create_metadata_items' )
311
311
@patch .object (clone_metadata_utils , 'list_metadata_items' )
312
- @patch ('cloudinary_cli.utils.utils.confirm_action ' )
312
+ @patch ('builtins.input' , return_value = 'true ' )
313
313
def test_compare_create_metadata_items_mixed_rules_scenario (self , mock_list , mock_create , mock_confirm ):
314
314
"""Test comparing with mix of new and existing rules"""
315
315
metadata_rules = {
@@ -349,7 +349,7 @@ def test_compare_create_metadata_items_mixed_rules_scenario(self, mock_list, moc
349
349
}
350
350
]
351
351
}
352
- mock_confirm . return_value = True
352
+
353
353
mock_source_metadata_rules = metadata_rules
354
354
mock_list .return_value = metadata_rules
355
355
0 commit comments