@@ -196,9 +196,38 @@ def test_validating_symlinked_tar_path(self, does_resolved_exist, path_mock):
196196 mock_path_object .resolve .return_value = mock_resolved_object
197197 mock_path_object .is_symlink = Mock ()
198198 mock_path_object .is_symlink .return_value = True
199+ mock_path_object .is_dir .return_value = False
199200
200201 path_mock .return_value = mock_path_object
201202
202203 result = _validate_destinations_exists (["mock_path" ])
203204
204205 self .assertEqual (result , does_resolved_exist )
206+
207+ @parameterized .expand (
208+ [
209+ (True ,),
210+ (False ,),
211+ ]
212+ )
213+ @patch ("samcli.lib.utils.tar.Path" )
214+ def test_validating_symlinked_tar_path_directory (self , file_exists , path_mock ):
215+ mock_child_resolve = Mock ()
216+ mock_child_resolve .exists .return_value = file_exists
217+
218+ mock_child = Mock ()
219+ mock_child .is_symlink .return_value = True
220+ mock_child .is_dir .return_value = False
221+ mock_child .resolve .return_value = mock_child_resolve
222+
223+ mock_dir_object = Mock ()
224+ mock_dir_object .is_symlink .return_value = False
225+ mock_dir_object .is_dir .return_value = True
226+ mock_dir_object .iterdir .return_value = ["mock_child" ]
227+ mock_dir_object .resolve = Mock ()
228+
229+ path_mock .side_effect = [mock_dir_object , mock_child ]
230+
231+ result = _validate_destinations_exists (["mock_folder" ])
232+
233+ self .assertEqual (result , file_exists )
0 commit comments