完善设备端体验与微信校验支持
This commit is contained in:
@@ -1,6 +1,10 @@
|
||||
import pytest
|
||||
|
||||
from database.init_db import _ensure_bind_session_card_columns, _ensure_cards_allow_multiple_per_device
|
||||
from database.init_db import (
|
||||
_ensure_bind_session_card_columns,
|
||||
_ensure_cards_allow_multiple_per_device,
|
||||
_ensure_device_family_tables,
|
||||
)
|
||||
|
||||
|
||||
class FakeScalarResult:
|
||||
@@ -21,6 +25,7 @@ class FakeConnection:
|
||||
self.column_counts = {
|
||||
"bind_mode": 0,
|
||||
"card_uuid": 0,
|
||||
"display_name": 0,
|
||||
}
|
||||
self.sql = []
|
||||
|
||||
@@ -64,3 +69,15 @@ async def test_ensure_cards_allow_multiple_per_device_replaces_unique_device_ind
|
||||
assert executed.index("ALTER TABLE cards ADD INDEX idx_cards_device_id") < executed.index(
|
||||
"ALTER TABLE cards DROP INDEX uq_cards_device_id"
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_ensure_device_family_tables_adds_display_name_column():
|
||||
conn = FakeConnection()
|
||||
|
||||
await _ensure_device_family_tables(conn)
|
||||
|
||||
executed = "\n".join(conn.sql)
|
||||
assert "CREATE TABLE IF NOT EXISTS device_family_members" in executed
|
||||
assert "display_name VARCHAR(64) NULL" in executed
|
||||
assert "ALTER TABLE device_family_members ADD COLUMN display_name VARCHAR(64) NULL AFTER role" in executed
|
||||
|
||||
Reference in New Issue
Block a user