mirror of
https://github.com/PR0M3TH3AN/VoxVera.git
synced 2025-09-09 15:38:43 +00:00
Merge pull request #65 from PR0M3TH3AN/codex/create-test-for-zip-download-in-cli
Add test for CLI build with download zip
This commit is contained in:
@@ -5,6 +5,7 @@ import shutil
|
|||||||
import json
|
import json
|
||||||
import datetime
|
import datetime
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
import zipfile
|
||||||
|
|
||||||
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "..")))
|
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "..")))
|
||||||
|
|
||||||
@@ -90,3 +91,15 @@ def test_check_missing(capsys, monkeypatch):
|
|||||||
captured = capsys.readouterr()
|
captured = capsys.readouterr()
|
||||||
assert "node: missing" in captured.out
|
assert "node: missing" in captured.out
|
||||||
|
|
||||||
|
|
||||||
|
def test_build_download_zip(tmp_path, monkeypatch):
|
||||||
|
_setup_tmp(monkeypatch, tmp_path)
|
||||||
|
config = json.load(open(tmp_path / "src" / "config.json"))
|
||||||
|
subdomain = config["subdomain"]
|
||||||
|
zip_path = tmp_path / "file.zip"
|
||||||
|
with zipfile.ZipFile(zip_path, "w") as zf:
|
||||||
|
zf.writestr("dummy.txt", "data")
|
||||||
|
cli.main(["build", "--download", str(zip_path)])
|
||||||
|
dest = tmp_path / "host" / subdomain / "download" / "download.zip"
|
||||||
|
assert dest.is_file()
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user