From 4a603a13fc43c790dfd24d71abe1aecd7ec848ad Mon Sep 17 00:00:00 2001 From: Kazuyoshi Kato Date: Mon, 19 May 2025 19:46:13 -0700 Subject: [PATCH] Test transcribe_worker.py I couldn't reproduce #118 with pytubefix 8.13.1. --- tools/process_new_vids/test/__init__.py | 0 tools/process_new_vids/test/test_transcribe_worker.py | 10 ++++++++++ tools/process_new_vids/transcribe_worker.py | 4 ++-- 3 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 tools/process_new_vids/test/__init__.py create mode 100644 tools/process_new_vids/test/test_transcribe_worker.py diff --git a/tools/process_new_vids/test/__init__.py b/tools/process_new_vids/test/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tools/process_new_vids/test/test_transcribe_worker.py b/tools/process_new_vids/test/test_transcribe_worker.py new file mode 100644 index 00000000..49f1b4a1 --- /dev/null +++ b/tools/process_new_vids/test/test_transcribe_worker.py @@ -0,0 +1,10 @@ +import unittest +from pytubefix import YouTube +import transcribe_worker + +class TestTranscribeWorker(unittest.TestCase): + def test_transcribe_worker(self): + BOARD_MEETING_MAY_13_2025 = 'cIVuHr9ub-Y' + video = YouTube(f"https://www.youtube.com/watch?v={BOARD_MEETING_MAY_13_2025}") + desc = transcribe_worker.get_description(video) + self.assertEqual(desc, "Seattle Public Schools") diff --git a/tools/process_new_vids/transcribe_worker.py b/tools/process_new_vids/transcribe_worker.py index 0d24bddc..4fe75749 100644 --- a/tools/process_new_vids/transcribe_worker.py +++ b/tools/process_new_vids/transcribe_worker.py @@ -21,8 +21,8 @@ WORKING_DIR = '/tmp/workspace/app/transcribe' AUTH_PARAMS = { - 'user_id': os.environ['CONTAINER_ID'], - 'auth_code': os.environ['API_PASSWORD'], + 'user_id': os.environ.get('CONTAINER_ID', 'container_id_unset'), + 'auth_code': os.environ.get('API_PASSWORD', 'api_password_unset'), }