aboutsummaryrefslogtreecommitdiff
path: root/test/test_postprocessors.py
diff options
context:
space:
mode:
authorpukkandan <pukkandan.ytdlp@gmail.com>2021-06-03 23:30:38 +0530
committerpukkandan <pukkandan.ytdlp@gmail.com>2021-06-06 00:59:04 +0530
commit752cda3880f30a46bed1d27b69188ab93ad1a368 (patch)
tree1a6bc38ff775f70f4723be63d6f635f6781d38d6 /test/test_postprocessors.py
parent9d83ad93d04a1e16fe4a2acadf5f9f10bef6d1b9 (diff)
Fix and refactor `prepare_outtmpl`
The following tests would have failed previously: %(id)d %(id)r %(ext)s-%(ext|def)d %(width|)d %(id)r %(height)r %(formats.0)r %s
Diffstat (limited to 'test/test_postprocessors.py')
-rw-r--r--test/test_postprocessors.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/test_postprocessors.py b/test/test_postprocessors.py
index 1f8f375cc..bdc2d93cb 100644
--- a/test/test_postprocessors.py
+++ b/test/test_postprocessors.py
@@ -8,7 +8,10 @@ import sys
import unittest
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
+from yt_dlp import YoutubeDL
+from yt_dlp.compat import compat_shlex_quote
from yt_dlp.postprocessor import (
+ ExecAfterDownloadPP,
FFmpegThumbnailsConvertorPP,
MetadataFromFieldPP,
MetadataFromTitlePP,
@@ -55,3 +58,14 @@ class TestConvertThumbnail(unittest.TestCase):
for _, out in tests:
os.remove(file.format(out))
+
+
+class TestExecAfterDownload(unittest.TestCase):
+ def test_parse_cmd(self):
+ pp = ExecAfterDownloadPP(YoutubeDL(), '')
+ info = {'filepath': 'file name'}
+ quoted_filepath = compat_shlex_quote(info['filepath'])
+
+ self.assertEqual(pp.parse_cmd('echo', info), 'echo %s' % quoted_filepath)
+ self.assertEqual(pp.parse_cmd('echo.{}', info), 'echo.%s' % quoted_filepath)
+ self.assertEqual(pp.parse_cmd('echo "%(filepath)s"', info), 'echo "%s"' % info['filepath'])