import pytest from src.data.database_manager import DatabaseManager def test_set_and_get_setting(tmp_path): db_path = tmp_path / "test_citorrent.db" db = DatabaseManager(str(db_path)) db.set_setting("download_path", "/downloads/my_torrents") value = db.get_setting("download_path") assert value == "/downloads/my_torrents" def test_get_nonexistent_setting(tmp_path): db_path = tmp_path / "test_citorrent.db" db = DatabaseManager(str(db_path)) value = db.get_setting("nonexistent") assert value is None def test_update_setting(tmp_path): db_path = tmp_path / "test_citorrent.db" db = DatabaseManager(str(db_path)) db.set_setting("max_connections", "100") db.set_setting("max_connections", "200") value = db.get_setting("max_connections") assert value == "200"