mirror of
https://github.com/TencentCloud/Octop.git
synced 2026-10-27 07:23:12 +08:00
* fix: adapt S3/Postgres backends and restore admin storage browse Published octop-harness 1.0.1 plus Octop-side spec mapping and protocol wrap stop expert start and Admin tree listing from failing on the older deepagents_backends surface. Browse now caches the backend session and can preview or download files. Co-authored-by: Cursor <cursoragent@cursor.com> * fix: keep Windows paths valid in storage browse fixtures f-string JSON turns backslashes into illegal escapes, so row_to_backend_spec sees an incomplete filesystem config on Windows CI. Co-authored-by: Cursor <cursoragent@cursor.com> * fix: write browse fixture bytes without Windows newline translation Path.write_text() converts LF to CRLF on Windows, so download assertions saw b'# hello\r\n'. Co-authored-by: Cursor <cursoragent@cursor.com> --------- Co-authored-by: jubaoliang <jubaoliang@tencent.com> Co-authored-by: Cursor <cursoragent@cursor.com>
24 lines
761 B
Python
24 lines
761 B
Python
"""Tests for single-level storage / workspace tree dedupe."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from octop.infra.backend.tree_listing import dedupe_tree_rows, is_listing_self
|
|
|
|
|
|
def test_is_listing_self_root() -> None:
|
|
assert is_listing_self("/", parent="/")
|
|
assert is_listing_self(".", parent="/")
|
|
assert not is_listing_self("a.txt", parent="/")
|
|
|
|
|
|
def test_dedupe_tree_rows_drops_self_and_merges() -> None:
|
|
rows = [
|
|
{"path": "/", "is_dir": True},
|
|
{"path": "a.txt", "is_dir": False, "size": 1},
|
|
{"path": "a.txt/", "is_dir": True},
|
|
{"path": "sub", "is_dir": True},
|
|
]
|
|
out = dedupe_tree_rows(rows, parent="/")
|
|
assert [row["path"] for row in out] == ["a.txt", "sub"]
|
|
assert out[0]["is_dir"] is True
|