fix: copy and move

This commit is contained in:
kodi
2026-03-11 11:45:06 +01:00
parent 05816751b1
commit 523395b92a
14 changed files with 239 additions and 15 deletions
@@ -1,5 +1,6 @@
from __future__ import annotations
import sqlite3
import sys
import tempfile
import unittest
@@ -58,6 +59,33 @@ class TaskRepositoryTest(unittest.TestCase):
}
)
def test_migrates_legacy_tasks_schema_missing_source_destination(self) -> None:
legacy_db_path = Path(self.temp_dir.name) / "legacy.db"
conn = sqlite3.connect(legacy_db_path)
conn.execute(
"""
CREATE TABLE tasks (
id TEXT PRIMARY KEY,
operation TEXT NOT NULL,
status TEXT NOT NULL,
created_at TEXT NOT NULL
)
"""
)
conn.commit()
conn.close()
repo = TaskRepository(str(legacy_db_path))
created = repo.create_task(
operation="move",
source="storage1/a.txt",
destination="storage2/a.txt",
)
self.assertEqual(created["operation"], "move")
self.assertEqual(created["source"], "storage1/a.txt")
self.assertEqual(created["destination"], "storage2/a.txt")
if __name__ == "__main__":
unittest.main()