def test_copy_file(self, os_mock, shutil_mock, dir_util_mock): src = '/tmp/soruce_file' dst = '/tmp/destination_file' os_mock.path.isdir.return_value = False utils.copy(src, dst) shutil_mock.copy.assert_called_once_with(src, dst) self.method_was_not_called(dir_util_mock.copy_tree)
def run(self): logger.debug('Start plugin creation "%s"', self.plugin_path) self.check() template_dir = os.path.join( os.path.dirname(__file__), '..', self.template_path) utils.copy(template_dir, self.plugin_path) utils.render_files_in_dir(self.plugin_path, self.render_ctx)
def test_copy_dir(self, os_mock, shutil_mock, dir_util_mock): src = '/tmp/soruce_file' dst = '/tmp/destination_file' os_mock.path.isdir.return_value = True utils.copy(src, dst) dir_util_mock.copy_tree.assert_called_once_with(src, dst, preserve_symlinks=True) self.method_was_not_called(shutil_mock.copy)
def test_copy_dir(self, os_mock, shutil_mock, dir_util_mock): src = '/tmp/soruce_file' dst = '/tmp/destination_file' os_mock.path.isdir.return_value = True utils.copy(src, dst) dir_util_mock.copy_tree.assert_called_once_with( src, dst, preserve_symlinks=True) self.method_was_not_called(shutil_mock.copy)
def run(self): logger.debug('Start plugin creation "%s"', self.plugin_path) self.check() for template_path in self.template_paths: template_dir = os.path.join( os.path.dirname(__file__), '..', template_path) utils.copy(template_dir, self.plugin_path) utils.render_files_in_dir(self.plugin_path, self.render_ctx)