You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
864 B
Python
24 lines
864 B
Python
# backend/tests/test_export.py — per-user 내보내기 번들 + 민감 필드 redact
|
|
import io
|
|
import json
|
|
import zipfile
|
|
|
|
|
|
def test_export_zip_has_bundles_and_redacts(client):
|
|
# 데모(지우) — 인증 없이 current_user=지우
|
|
raw = client.get("/api/me/export").content
|
|
z = zipfile.ZipFile(io.BytesIO(raw))
|
|
names = set(z.namelist())
|
|
assert {"profile.json", "tasks.json", "emails.json", "connectors.json"} <= names
|
|
|
|
profile = json.loads(z.read("profile.json"))
|
|
assert profile["id"] == "jiwoo"
|
|
|
|
# 커넥터 토큰 등 민감 필드는 redact (평문/암호문 노출 금지)
|
|
conns = json.loads(z.read("connectors.json"))
|
|
for c in conns:
|
|
assert c.get("token_enc") in (None, "", "[redacted]")
|
|
|
|
tasks = json.loads(z.read("tasks.json"))
|
|
assert len(tasks) > 0 and all(t["user_id"] == "jiwoo" for t in tasks)
|