Files
Nexus/tests/test_rsync_push_permissions.py
T
Nexus Agent c8b0663508
Nexus CI/CD / test (push) Waiting to run
Nexus CI/CD / deploy (push) Blocked by required conditions
Nexus Pre-commit Checks / quick-check (push) Waiting to run
feat: 批量IP添加、脚本库历史、推送权限记录与脚本SSH执行修复
批量添加替代CSV并支持去重;脚本库页内嵌执行历史;推送历史记录 rsync 权限策略;
脚本执行不再依赖 Agent 在线;服务器同步日志与相关单测补齐。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-08 03:15:40 +08:00

30 lines
1000 B
Python

"""Tests for rsync push permission flags."""
from server.application.services.sync_engine_v2 import (
rsync_push_permission_args,
rsync_push_permission_summary,
)
from server.config import settings
def test_rsync_push_permission_defaults():
args = rsync_push_permission_args()
assert "--chown" in args
assert "www:www" in args
assert "--chmod" in args
assert "D755,F755" in args
assert rsync_push_permission_summary() == "chown=www:www chmod=D755,F755"
def test_rsync_push_permission_disabled(monkeypatch):
monkeypatch.setattr(settings, "RSYNC_PUSH_CHOWN", "")
monkeypatch.setattr(settings, "RSYNC_PUSH_CHMOD", "")
assert rsync_push_permission_args() == []
assert rsync_push_permission_summary() is None
def test_rsync_push_permission_rejects_invalid_chown(monkeypatch):
monkeypatch.setattr(settings, "RSYNC_PUSH_CHOWN", "www;rm -rf /")
monkeypatch.setattr(settings, "RSYNC_PUSH_CHMOD", "")
assert rsync_push_permission_args() == []