mirror of
https://github.com/Arrowar/StreamingCommunity.git
synced 2025-06-03 10:00:10 +00:00
feat: add HLS and MP4 download tests with unittest
This commit is contained in:
parent
00bcdbce9b
commit
a376556f60
2
.github/workflows/build.yml
vendored
2
.github/workflows/build.yml
vendored
@ -70,7 +70,7 @@ jobs:
|
||||
executable: StreamingCommunity_linux_latest
|
||||
separator: ':'
|
||||
|
||||
- os: ubuntu-20.04
|
||||
- os: ubuntu-22.04
|
||||
artifact_name: StreamingCommunity_linux_previous
|
||||
executable: StreamingCommunity_linux_previous
|
||||
separator: ':'
|
||||
|
44
.github/workflows/testing.yml
vendored
44
.github/workflows/testing.yml
vendored
@ -48,4 +48,46 @@ jobs:
|
||||
|
||||
- name: Run osPath test
|
||||
run: |
|
||||
PYTHONPATH=$PYTHONPATH:$(pwd) python -m Test.Util.osPath
|
||||
PYTHONPATH=$PYTHONPATH:$(pwd) python -m Test.Util.osPath
|
||||
|
||||
test-hls-download:
|
||||
name: Test HLS Download
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: '3.11'
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
|
||||
|
||||
- name: Run HLS download test
|
||||
run: |
|
||||
PYTHONPATH=$PYTHONPATH:$(pwd) python -m unittest Test.Download.HLS
|
||||
|
||||
test-mp4-download:
|
||||
name: Test MP4 Download
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: '3.11'
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
|
||||
|
||||
- name: Run MP4 download test
|
||||
run: |
|
||||
PYTHONPATH=$PYTHONPATH:$(pwd) python -m unittest Test.Download.MP4
|
@ -1,5 +1,7 @@
|
||||
# 23.06.24
|
||||
|
||||
import unittest
|
||||
|
||||
# Fix import
|
||||
import sys
|
||||
import os
|
||||
@ -16,10 +18,31 @@ from StreamingCommunity.Util.logger import Logger
|
||||
from StreamingCommunity.Lib.Downloader import HLS_Downloader
|
||||
|
||||
|
||||
# Test
|
||||
start_message()
|
||||
"""start_message()
|
||||
logger = Logger()
|
||||
print("Return: ", HLS_Downloader(
|
||||
output_path="test.mp4",
|
||||
result = HLS_Downloader(
|
||||
output_path=".\\Video\\test.mp4",
|
||||
m3u8_url="https://acdn.ak-stream-videoplatform.sky.it/hls/2024/11/21/968275/master.m3u8"
|
||||
).start())
|
||||
).start()
|
||||
|
||||
thereIsError = result['error'] is not None
|
||||
print(thereIsError)"""
|
||||
|
||||
|
||||
class TestHLSDownloader(unittest.TestCase):
|
||||
def setUp(self):
|
||||
os_summary.get_system_summary()
|
||||
start_message()
|
||||
self.logger = Logger()
|
||||
|
||||
def test_hls_download(self):
|
||||
result = HLS_Downloader(
|
||||
output_path=".\\Video\\test.mp4",
|
||||
m3u8_url="https://acdn.ak-stream-videoplatform.sky.it/hls/2024/11/21/968275/master.m3u8"
|
||||
).start()
|
||||
|
||||
thereIsError = result['error'] is not None
|
||||
self.assertFalse(thereIsError, "HLS download resulted in an error")
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
@ -1,5 +1,7 @@
|
||||
# 23.06.24
|
||||
|
||||
import unittest
|
||||
|
||||
# Fix import
|
||||
import sys
|
||||
import os
|
||||
@ -16,10 +18,30 @@ from StreamingCommunity.Util.logger import Logger
|
||||
from StreamingCommunity.Lib.Downloader import MP4_downloader
|
||||
|
||||
|
||||
# Test
|
||||
start_message()
|
||||
"""start_message()
|
||||
logger = Logger()
|
||||
print("Return: ", MP4_downloader(
|
||||
path, kill_handler = MP4_downloader(
|
||||
url="https://148-251-75-109.top/Getintopc.com/IDA_Pro_2020.mp4",
|
||||
path=r".\Video\undefined.mp4"
|
||||
))
|
||||
path=r".\\Video\\undefined.mp4"
|
||||
)
|
||||
|
||||
thereIsError = path is None
|
||||
print(thereIsError)"""
|
||||
|
||||
class TestMP4Downloader(unittest.TestCase):
|
||||
def setUp(self):
|
||||
os_summary.get_system_summary()
|
||||
start_message()
|
||||
self.logger = Logger()
|
||||
|
||||
def test_mp4_download(self):
|
||||
path, kill_handler = MP4_downloader(
|
||||
url="https://148-251-75-109.top/Getintopc.com/IDA_Pro_2020.mp4",
|
||||
path=r".\\Video\\undefined.mp4"
|
||||
)
|
||||
|
||||
thereIsError = path is None
|
||||
self.assertFalse(thereIsError, "MP4 download resulted in an error")
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
Loading…
x
Reference in New Issue
Block a user