ticket #68 attempt 2
This commit is contained in:
parent
35e79ba8c7
commit
4ffddc8913
File diff suppressed because one or more lines are too long
@ -7,6 +7,7 @@ from pathlib import Path
|
||||
import pytest
|
||||
from devplacepy.database import init_db, get_table, refresh_snapshot
|
||||
from devplacepy import project_files
|
||||
from devplacepy.config import PROJECT_FILES_DIR
|
||||
from devplacepy.project_files import ProjectFileError
|
||||
from devplacepy.services.jobs import queue
|
||||
from devplacepy.services.jobs.zip_service import ZipService
|
||||
@ -130,6 +131,32 @@ def test_process_whole_project(zip_env):
|
||||
assert job["bytes_out"] == Path(result["local_path"]).stat().st_size
|
||||
|
||||
|
||||
def test_zip_with_missing_blob_succeeds(zip_env):
|
||||
pid, _ = _make_project(binary=True)
|
||||
binary_row = get_table("project_files").find_one(
|
||||
project_uid=pid, is_binary=1
|
||||
)
|
||||
assert binary_row is not None
|
||||
blob_path = PROJECT_FILES_DIR / binary_row["directory"] / binary_row["stored_name"]
|
||||
assert blob_path.is_file()
|
||||
blob_path.unlink()
|
||||
assert not blob_path.exists()
|
||||
uid = queue.enqueue(
|
||||
"zip",
|
||||
{"source": {"type": "project_tree", "project_uid": pid, "path": ""}},
|
||||
"user",
|
||||
"u",
|
||||
"ProjMissing",
|
||||
)
|
||||
_process_zip_jobs()
|
||||
job = queue.get_job(uid)
|
||||
assert job["status"] == "done"
|
||||
assert job["bytes_out"] > 0
|
||||
assert job["result"]["file_count"] == 2
|
||||
names = sorted(zipfile.ZipFile(job["result"]["local_path"]).namelist())
|
||||
assert "assets/logo.bin" not in names
|
||||
|
||||
|
||||
def test_process_subtree_folder(zip_env):
|
||||
pid, _ = _make_project()
|
||||
uid = queue.enqueue(
|
||||
|
||||
Loading…
Reference in New Issue
Block a user