Spaces:
Sleeping
Sleeping
CB commited on
Create tests/test_upload_flow.py
Browse files- tests/test_upload_flow.py +16 -0
tests/test_upload_flow.py
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
import tempfile
|
| 3 |
+
from streamlit_app import compress_video, file_sha256
|
| 4 |
+
|
| 5 |
+
def test_file_hash(tmp_path):
|
| 6 |
+
f = tmp_path / "a.txt"
|
| 7 |
+
f.write_bytes(b"hello")
|
| 8 |
+
assert file_sha256(str(f)) is not None
|
| 9 |
+
|
| 10 |
+
def test_compress_no_crash(tmp_path):
|
| 11 |
+
# create a tiny fake mp4 or reuse a small file — here we just ensure function runs without raising
|
| 12 |
+
src = tmp_path / "in.mp4"
|
| 13 |
+
src.write_bytes(b"\x00\x00\x00")
|
| 14 |
+
out = str(tmp_path / "out.mp4")
|
| 15 |
+
res = compress_video(str(src), out)
|
| 16 |
+
assert isinstance(res, str)
|