test(cli): cover expiry preservation on moves
- Assert tracked-file moves keep an existing remote expires_at value. - Keep the move regression focused on metadata preservation.
This commit is contained in:
@@ -95,7 +95,7 @@ def test_sync_uploads_nested_local_files(tmp_path, monkeypatch):
|
||||
|
||||
def test_sync_updates_remote_path_when_tracked_file_moves(tmp_path, monkeypatch):
|
||||
fake = FakeClient()
|
||||
fake.remote_files = [{'file_id': 'file_1', 'file_name': 'old.txt', 'file_path': '', 'file_size': '5 Bytes'}]
|
||||
fake.remote_files = [{'file_id': 'file_1', 'file_name': 'old.txt', 'file_path': '', 'file_size': '5 Bytes', 'expires_at': 123456}]
|
||||
monkeypatch.setattr(cli, 'make_client', lambda args: fake)
|
||||
|
||||
state_dir = tmp_path / '.nanoshare-sync'
|
||||
@@ -129,6 +129,7 @@ def test_sync_updates_remote_path_when_tracked_file_moves(tmp_path, monkeypatch)
|
||||
assert fake.deleted == []
|
||||
assert fake.remote_files[0]['file_name'] == 'new.txt'
|
||||
assert fake.remote_files[0]['file_path'] == 'docs'
|
||||
assert fake.remote_files[0]['expires_at'] == 123456
|
||||
assert 'note' not in fake.remote_files[0]
|
||||
state = json.loads((state_dir / 'state.json').read_text())
|
||||
assert 'old.txt' not in state['files']
|
||||
|
||||
Reference in New Issue
Block a user