Creator App Tests / PR Spam Gate (push) Skipped
Frontend Tests / PR Spam Gate (push) Skipped
NPM Format (website & console) / PR Spam Gate (push) Skipped
Pre-commit Checks / PR Spam Gate (push) Skipped
QwenPaw Creator Plugin Release / check-version (push) Canceled after 0s
QwenPaw Creator Plugin Release / upload-oss (push) Canceled after 0s
Tests / PR Spam Gate (push) Skipped
CodeQL / CodeQL (python) (push) Canceled after 0s
CodeQL / CodeQL (typescript) (push) Canceled after 0s
Creator App Tests / Creator Backend Tests (push) Canceled after 0s
Creator App Tests / Creator UI Build & Tests (push) Canceled after 0s
E2E Smoke Tests / Playwright UI Smoke (push) Canceled after 0s
Frontend Tests / Detect console changes (push) Canceled after 0s
NPM Format (website & console) / website format check (push) Canceled after 0s
NPM Format (website & console) / console format check (push) Canceled after 0s
Pre-commit Checks / Pre-commit (push) Canceled after 0s
QwenPaw Data Plugin Release / check-version (push) Canceled after 0s
Tests / Detect code changes (push) Canceled after 0s
Frontend Tests / Vitest Unit Tests (push) Canceled after 0s
Frontend Tests / Frontend Summary (push) Canceled after 0s
QwenPaw Data Plugin Release / upload-oss (push) Canceled after 0s
Tests / Maintainer Approval (push) Canceled after 0s
Tests / Unit Tests - py3.11 - macos-latest (push) Canceled after 0s
Tests / Unit Tests - py3.11 - ubuntu-latest (push) Canceled after 0s
Tests / Unit Tests - py3.13 - ubuntu-latest (push) Canceled after 0s
Tests / Unit Tests - py3.11 - windows-latest (push) Canceled after 0s
Tests / Contract Tests - py3.11 - macos-latest (push) Canceled after 0s
Tests / Contract Tests - py3.11 - ubuntu-latest (push) Canceled after 0s
Tests / Contract Tests - py3.13 - ubuntu-latest (push) Canceled after 0s
Tests / Contract Tests - py3.11 - windows-latest (push) Canceled after 0s
Tests / Integrated Tests - py3.11 - macos-latest - p0 (push) Canceled after 0s
Tests / Integrated Tests - py3.11 - macos-latest - p1 (push) Canceled after 0s
Tests / Integrated Tests - py3.11 - macos-latest - p2 (push) Canceled after 0s
Tests / Integrated Tests - py3.11 - ubuntu-latest - fallback (push) Canceled after 0s
Tests / Integrated Tests - py3.11 - ubuntu-latest - p0 (push) Canceled after 0s
Tests / Integrated Tests - py3.11 - ubuntu-latest - p1 (push) Canceled after 0s
Tests / Integrated Tests - py3.11 - ubuntu-latest - p2 (push) Canceled after 0s
Tests / Integrated Tests - py3.13 - ubuntu-latest - p0 (push) Canceled after 0s
Tests / Integrated Tests - py3.13 - ubuntu-latest - p1 (push) Canceled after 0s
Tests / Integrated Tests - py3.13 - ubuntu-latest - p2 (push) Canceled after 0s
Tests / Integrated Tests - py3.11 - windows-latest - p0 (push) Canceled after 0s
Tests / Integrated Tests - py3.11 - windows-latest - p1 (push) Canceled after 0s
Tests / Integrated Tests - py3.11 - windows-latest - p2 (push) Canceled after 0s
Tests / Coverage Report (push) Canceled after 0s
Tests / Test Summary (push) Canceled after 0s
69 lines
2.1 KiB
Python
69 lines
2.1 KiB
Python
# -*- coding: utf-8 -*-
|
|
"""Integration tests for the Files directory browser."""
|
|
from __future__ import annotations
|
|
|
|
from pathlib import Path
|
|
|
|
import pytest
|
|
from helpers import default_http_timeout
|
|
|
|
_HTTP_TIMEOUT = default_http_timeout(30.0)
|
|
_BASE = "/api/workspace/project-directory"
|
|
|
|
|
|
@pytest.mark.integration
|
|
@pytest.mark.p1
|
|
def test_create_browsed_directory_creates_direct_child(app_server):
|
|
"""Creating a browsed folder makes one direct child directory."""
|
|
root = Path(app_server.working_dir) / "integ-create-folder-root"
|
|
root.mkdir(parents=True, exist_ok=True)
|
|
|
|
resp = app_server.api_request(
|
|
"POST",
|
|
f"{_BASE}/browse-dirs/create",
|
|
json={"parent": str(root), "name": "new-folder"},
|
|
timeout=_HTTP_TIMEOUT,
|
|
)
|
|
|
|
target = root / "new-folder"
|
|
assert resp.status_code == 201, resp.text
|
|
assert target.is_dir()
|
|
assert resp.json() == {"path": str(target), "name": "new-folder"}
|
|
|
|
|
|
@pytest.mark.integration
|
|
@pytest.mark.p2
|
|
def test_create_browsed_directory_rejects_traversal(app_server):
|
|
"""A folder name cannot escape the browsed parent directory."""
|
|
root = Path(app_server.working_dir) / "integ-create-folder-safe-root"
|
|
root.mkdir(parents=True, exist_ok=True)
|
|
escaped = root.parent / "escaped-folder"
|
|
|
|
resp = app_server.api_request(
|
|
"POST",
|
|
f"{_BASE}/browse-dirs/create",
|
|
json={"parent": str(root), "name": "../escaped-folder"},
|
|
timeout=_HTTP_TIMEOUT,
|
|
)
|
|
|
|
assert resp.status_code == 400, resp.text
|
|
assert not escaped.exists()
|
|
|
|
|
|
@pytest.mark.integration
|
|
@pytest.mark.p2
|
|
def test_create_browsed_directory_rejects_existing_name(app_server):
|
|
"""Creating an existing child reports a conflict."""
|
|
root = Path(app_server.working_dir) / "integ-create-folder-conflict"
|
|
target = root / "existing"
|
|
target.mkdir(parents=True, exist_ok=True)
|
|
|
|
resp = app_server.api_request(
|
|
"POST",
|
|
f"{_BASE}/browse-dirs/create",
|
|
json={"parent": str(root), "name": "existing"},
|
|
timeout=_HTTP_TIMEOUT,
|
|
)
|
|
|
|
assert resp.status_code == 409, resp.text
|