aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/test_YoutubeDL.py
diff options
context:
space:
mode:
authordf <[email protected]>2021-08-01 09:42:57 +0100
committerdirkf <[email protected]>2022-02-26 10:29:42 +0000
commit6508688e88c83bb811653083db9351702cd39a6a (patch)
tree70dc3e555bdd74947bbb48adc7ad065ca7fc2b6c /test/test_YoutubeDL.py
parent4194d253c0b922addf0439228066cb4fb487bac3 (diff)
downloadyoutube-dl-6508688e88c83bb811653083db9351702cd39a6a.tar.gz
youtube-dl-6508688e88c83bb811653083db9351702cd39a6a.zip
Make default upload_/release_date a compat_str
Ensures download tests pass in Python 2 as well as 3; also add YoutubeDL tests for timestamp -> upload_date etc.
Diffstat (limited to 'test/test_YoutubeDL.py')
-rw-r--r--test/test_YoutubeDL.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/test_YoutubeDL.py b/test/test_YoutubeDL.py
index a35effe0e..f8c8e619c 100644
--- a/test/test_YoutubeDL.py
+++ b/test/test_YoutubeDL.py
@@ -997,6 +997,25 @@ class TestYoutubeDL(unittest.TestCase):
self.assertEqual(downloaded['extractor'], 'Video')
self.assertEqual(downloaded['extractor_key'], 'Video')
+ def test_default_times(self):
+ """Test addition of missing upload/release/_date from /release_/timestamp"""
+ info = {
+ 'id': '1234',
+ 'url': TEST_URL,
+ 'title': 'Title',
+ 'ext': 'mp4',
+ 'timestamp': 1631352900,
+ 'release_timestamp': 1632995931,
+ }
+
+ params = {'simulate': True, }
+ ydl = FakeYDL(params)
+ out_info = ydl.process_ie_result(info)
+ self.assertTrue(isinstance(out_info['upload_date'], compat_str))
+ self.assertEqual(out_info['upload_date'], '20210911')
+ self.assertTrue(isinstance(out_info['release_date'], compat_str))
+ self.assertEqual(out_info['release_date'], '20210930')
+
if __name__ == '__main__':
unittest.main()