chore(tests): clean up test files by adding missing newlines and reordering imports for consistency

This commit is contained in:
2026-01-02 20:36:42 -06:00
parent 4ea47b9dcf
commit adbf0a9ce9
9 changed files with 631 additions and 102 deletions

View File

@@ -1,10 +1,12 @@
import os
import sqlite3
import tempfile
import pytest
from meshchatx.src.backend.database.legacy_migrator import LegacyMigrator
from meshchatx.src.backend.database.provider import DatabaseProvider
from meshchatx.src.backend.database.schema import DatabaseSchema
from meshchatx.src.backend.database.legacy_migrator import LegacyMigrator
@pytest.fixture
@@ -31,7 +33,7 @@ def test_database_initialization(temp_db):
# Check version
version_row = provider.fetchone(
"SELECT value FROM config WHERE key = 'database_version'"
"SELECT value FROM config WHERE key = 'database_version'",
)
assert int(version_row["value"]) == DatabaseSchema.LATEST_VERSION
@@ -54,7 +56,7 @@ def test_legacy_migrator_detection(temp_db):
legacy_conn = sqlite3.connect(legacy_db_path)
legacy_conn.execute("CREATE TABLE config (key TEXT, value TEXT)")
legacy_conn.execute(
"INSERT INTO config (key, value) VALUES ('display_name', 'Legacy User')"
"INSERT INTO config (key, value) VALUES ('display_name', 'Legacy User')",
)
legacy_conn.commit()
legacy_conn.close()
@@ -80,14 +82,14 @@ def test_legacy_migration_data(temp_db):
# Create legacy DB with some data
legacy_conn = sqlite3.connect(legacy_db_path)
legacy_conn.execute(
"CREATE TABLE lxmf_messages (hash TEXT UNIQUE, content TEXT)"
"CREATE TABLE lxmf_messages (hash TEXT UNIQUE, content TEXT)",
)
legacy_conn.execute(
"INSERT INTO lxmf_messages (hash, content) VALUES ('msg1', 'Hello Legacy')"
"INSERT INTO lxmf_messages (hash, content) VALUES ('msg1', 'Hello Legacy')",
)
legacy_conn.execute("CREATE TABLE config (key TEXT UNIQUE, value TEXT)")
legacy_conn.execute(
"INSERT INTO config (key, value) VALUES ('test_key', 'test_val')"
"INSERT INTO config (key, value) VALUES ('test_key', 'test_val')",
)
legacy_conn.commit()
legacy_conn.close()
@@ -97,12 +99,12 @@ def test_legacy_migration_data(temp_db):
# Verify data moved
msg_row = provider.fetchone(
"SELECT content FROM lxmf_messages WHERE hash = 'msg1'"
"SELECT content FROM lxmf_messages WHERE hash = 'msg1'",
)
assert msg_row["content"] == "Hello Legacy"
config_row = provider.fetchone(
"SELECT value FROM config WHERE key = 'test_key'"
"SELECT value FROM config WHERE key = 'test_key'",
)
assert config_row["value"] == "test_val"