aboutsummaryrefslogtreecommitdiffstats
path: root/test/helper.py
diff options
context:
space:
mode:
authorpukkandan <pukkandan.ytdlp@gmail.com>2022-11-10 07:32:25 +0530
committerpukkandan <pukkandan.ytdlp@gmail.com>2022-11-10 07:32:35 +0530
commit495322b95bbf8befa0f0b354f110a1d4eddac784 (patch)
treefc592024f32152ce0894eba7ac35c28331e6b49c /test/helper.py
parentc789fb778798d682a1b2d3c74180ba8d20c23552 (diff)
downloadhypervideo-pre-495322b95bbf8befa0f0b354f110a1d4eddac784.tar.lz
hypervideo-pre-495322b95bbf8befa0f0b354f110a1d4eddac784.tar.xz
hypervideo-pre-495322b95bbf8befa0f0b354f110a1d4eddac784.zip
[test] Allow `extract_flat` in download tests
Authored by: coletdjnz, pukkandan
Diffstat (limited to 'test/helper.py')
-rw-r--r--test/helper.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/test/helper.py b/test/helper.py
index 3b3b44580..139bdafc3 100644
--- a/test/helper.py
+++ b/test/helper.py
@@ -222,6 +222,10 @@ def sanitize_got_info_dict(got_dict):
if test_info_dict.get('display_id') == test_info_dict.get('id'):
test_info_dict.pop('display_id')
+ # Check url for flat entries
+ if got_dict.get('_type', 'video') != 'video' and got_dict.get('url'):
+ test_info_dict['url'] = got_dict['url']
+
return test_info_dict
@@ -235,8 +239,9 @@ def expect_info_dict(self, got_dict, expected_dict):
for key in mandatory_fields:
self.assertTrue(got_dict.get(key), 'Missing mandatory field %s' % key)
# Check for mandatory fields that are automatically set by YoutubeDL
- for key in ['webpage_url', 'extractor', 'extractor_key']:
- self.assertTrue(got_dict.get(key), 'Missing field: %s' % key)
+ if got_dict.get('_type', 'video') == 'video':
+ for key in ['webpage_url', 'extractor', 'extractor_key']:
+ self.assertTrue(got_dict.get(key), 'Missing field: %s' % key)
test_info_dict = sanitize_got_info_dict(got_dict)