30 lines
1000 B
Python
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() == []
|