25 lines
589 B
Python
25 lines
589 B
Python
|
|
"""Client-supplied push batch_id for WebSocket progress before POST."""
|
||
|
|
|
||
|
|
import pytest
|
||
|
|
|
||
|
|
from server.api.schemas import SyncFiles
|
||
|
|
|
||
|
|
|
||
|
|
def test_sync_files_accepts_client_batch_id():
|
||
|
|
bid = "abc123def456"
|
||
|
|
payload = SyncFiles(
|
||
|
|
server_ids=[1],
|
||
|
|
source_path="/tmp/nexus_upload_test",
|
||
|
|
batch_id=bid,
|
||
|
|
)
|
||
|
|
assert payload.batch_id == bid
|
||
|
|
|
||
|
|
|
||
|
|
def test_sync_files_rejects_invalid_batch_id():
|
||
|
|
with pytest.raises(ValueError):
|
||
|
|
SyncFiles(
|
||
|
|
server_ids=[1],
|
||
|
|
source_path="/tmp/nexus_upload_test",
|
||
|
|
batch_id="not-hex-id",
|
||
|
|
)
|