mirror of
https://github.com/jkingsman/Remote-Terminal-for-MeshCore.git
synced 2026-08-11 11:13:04 +02:00
Clean up legacy sort order
This commit is contained in:
@@ -222,7 +222,6 @@ export interface AppSettings {
|
||||
max_radio_contacts: number;
|
||||
favorites: Favorite[];
|
||||
auto_decrypt_dm_on_advert: boolean;
|
||||
sidebar_sort_order: string;
|
||||
last_message_times: Record<string, number>;
|
||||
preferences_migrated: boolean;
|
||||
advert_interval: number;
|
||||
|
||||
@@ -25,6 +25,16 @@ test.describe('Apprise integration settings', () => {
|
||||
receiver.close();
|
||||
});
|
||||
|
||||
test.beforeEach(async () => {
|
||||
// Clean up any stale configs from previous failed runs
|
||||
const configs = await getFanoutConfigs();
|
||||
for (const c of configs.filter((c) => c.name === 'E2E Apprise')) {
|
||||
try {
|
||||
await deleteFanoutConfig(c.id);
|
||||
} catch { /* ignore */ }
|
||||
}
|
||||
});
|
||||
|
||||
test.afterEach(async () => {
|
||||
if (createdAppriseId) {
|
||||
try {
|
||||
@@ -66,16 +76,15 @@ test.describe('Apprise integration settings', () => {
|
||||
await page.getByRole('button', { name: /Save as Enabled/i }).click();
|
||||
await expect(page.getByText('Integration saved and enabled')).toBeVisible();
|
||||
|
||||
// Should be back on list view with our apprise config visible
|
||||
await expect(page.getByText('E2E Apprise')).toBeVisible();
|
||||
await expect(page.getByText(appriseUrl)).toBeVisible();
|
||||
|
||||
// Clean up via API
|
||||
// Capture ID for cleanup before assertions that might fail
|
||||
const configs = await getFanoutConfigs();
|
||||
const apprise = configs.find((c) => c.name === 'E2E Apprise');
|
||||
if (apprise) {
|
||||
createdAppriseId = apprise.id;
|
||||
}
|
||||
|
||||
// Should be back on list view with our apprise config visible
|
||||
await expect(fanoutHeader(page, 'E2E Apprise')).toBeVisible();
|
||||
});
|
||||
|
||||
test('create apprise via API, verify options persist after edit', async ({ page }) => {
|
||||
|
||||
@@ -293,7 +293,6 @@ class TestDebugEndpoint:
|
||||
json={
|
||||
"max_radio_contacts": 321,
|
||||
"auto_decrypt_dm_on_advert": True,
|
||||
"sidebar_sort_order": "alpha",
|
||||
"advert_interval": 7200,
|
||||
"flood_scope": "US-CA",
|
||||
"blocked_keys": [pub_key],
|
||||
|
||||
@@ -364,7 +364,7 @@ class TestDeleteContactCascade:
|
||||
assert len(await ContactAdvertPathRepository.get_recent_for_contact(KEY_A)) == 0
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_delete_removes_direct_messages(self, test_db, client):
|
||||
async def test_delete_preserves_direct_messages(self, test_db, client):
|
||||
await _insert_contact(KEY_A, "Alice")
|
||||
|
||||
# Create a DM for this contact
|
||||
@@ -375,8 +375,6 @@ class TestDeleteContactCascade:
|
||||
sender_timestamp=1000,
|
||||
received_at=1000,
|
||||
)
|
||||
msgs = await MessageRepository.get_all(msg_type="PRIV", conversation_key=KEY_A)
|
||||
assert len(msgs) == 1
|
||||
|
||||
with patch("app.routers.contacts.radio_manager") as mock_rm:
|
||||
mock_rm.is_connected = False
|
||||
@@ -387,9 +385,9 @@ class TestDeleteContactCascade:
|
||||
|
||||
assert response.status_code == 200
|
||||
|
||||
# DMs for the deleted contact should be gone
|
||||
# DMs are preserved so they re-surface if the contact is re-added
|
||||
msgs = await MessageRepository.get_all(msg_type="PRIV", conversation_key=KEY_A)
|
||||
assert len(msgs) == 0
|
||||
assert len(msgs) == 1
|
||||
|
||||
|
||||
class TestMarkRead:
|
||||
|
||||
+16
-16
@@ -1249,8 +1249,8 @@ class TestMigration039:
|
||||
|
||||
applied = await run_migrations(conn)
|
||||
|
||||
assert applied == 12
|
||||
assert await get_version(conn) == 50
|
||||
assert applied == 13
|
||||
assert await get_version(conn) == 51
|
||||
|
||||
cursor = await conn.execute(
|
||||
"""
|
||||
@@ -1321,8 +1321,8 @@ class TestMigration039:
|
||||
|
||||
applied = await run_migrations(conn)
|
||||
|
||||
assert applied == 12
|
||||
assert await get_version(conn) == 50
|
||||
assert applied == 13
|
||||
assert await get_version(conn) == 51
|
||||
|
||||
cursor = await conn.execute(
|
||||
"""
|
||||
@@ -1388,8 +1388,8 @@ class TestMigration039:
|
||||
|
||||
applied = await run_migrations(conn)
|
||||
|
||||
assert applied == 6
|
||||
assert await get_version(conn) == 50
|
||||
assert applied == 7
|
||||
assert await get_version(conn) == 51
|
||||
|
||||
cursor = await conn.execute(
|
||||
"""
|
||||
@@ -1441,8 +1441,8 @@ class TestMigration040:
|
||||
|
||||
applied = await run_migrations(conn)
|
||||
|
||||
assert applied == 11
|
||||
assert await get_version(conn) == 50
|
||||
assert applied == 12
|
||||
assert await get_version(conn) == 51
|
||||
|
||||
await conn.execute(
|
||||
"""
|
||||
@@ -1503,8 +1503,8 @@ class TestMigration041:
|
||||
|
||||
applied = await run_migrations(conn)
|
||||
|
||||
assert applied == 10
|
||||
assert await get_version(conn) == 50
|
||||
assert applied == 11
|
||||
assert await get_version(conn) == 51
|
||||
|
||||
await conn.execute(
|
||||
"""
|
||||
@@ -1556,8 +1556,8 @@ class TestMigration042:
|
||||
|
||||
applied = await run_migrations(conn)
|
||||
|
||||
assert applied == 9
|
||||
assert await get_version(conn) == 50
|
||||
assert applied == 10
|
||||
assert await get_version(conn) == 51
|
||||
|
||||
await conn.execute(
|
||||
"""
|
||||
@@ -1696,8 +1696,8 @@ class TestMigration046:
|
||||
|
||||
applied = await run_migrations(conn)
|
||||
|
||||
assert applied == 5
|
||||
assert await get_version(conn) == 50
|
||||
assert applied == 6
|
||||
assert await get_version(conn) == 51
|
||||
|
||||
cursor = await conn.execute(
|
||||
"""
|
||||
@@ -1790,8 +1790,8 @@ class TestMigration047:
|
||||
|
||||
applied = await run_migrations(conn)
|
||||
|
||||
assert applied == 4
|
||||
assert await get_version(conn) == 50
|
||||
assert applied == 5
|
||||
assert await get_version(conn) == 51
|
||||
|
||||
cursor = await conn.execute(
|
||||
"""
|
||||
|
||||
@@ -622,7 +622,6 @@ class TestAppSettingsRepository:
|
||||
"max_radio_contacts": 250,
|
||||
"favorites": "{not-json",
|
||||
"auto_decrypt_dm_on_advert": 1,
|
||||
"sidebar_sort_order": "invalid",
|
||||
"last_message_times": "{also-not-json",
|
||||
"preferences_migrated": 0,
|
||||
"advert_interval": None,
|
||||
@@ -645,7 +644,6 @@ class TestAppSettingsRepository:
|
||||
assert settings.max_radio_contacts == 250
|
||||
assert settings.favorites == []
|
||||
assert settings.last_message_times == {}
|
||||
assert settings.sidebar_sort_order == "recent"
|
||||
assert settings.advert_interval == 0
|
||||
assert settings.last_advert_time == 0
|
||||
|
||||
@@ -680,7 +678,7 @@ class TestAppSettingsRepository:
|
||||
from app.models import AppSettings
|
||||
|
||||
current = AppSettings(preferences_migrated=False)
|
||||
migrated = AppSettings(preferences_migrated=True, sidebar_sort_order="recent")
|
||||
migrated = AppSettings(preferences_migrated=True)
|
||||
|
||||
with (
|
||||
patch(
|
||||
@@ -704,7 +702,7 @@ class TestAppSettingsRepository:
|
||||
|
||||
assert did_migrate is True
|
||||
assert result.preferences_migrated is True
|
||||
assert mock_update.call_args.kwargs["sidebar_sort_order"] == "recent"
|
||||
assert "sidebar_sort_order" not in mock_update.call_args.kwargs
|
||||
assert mock_update.call_args.kwargs["preferences_migrated"] is True
|
||||
|
||||
|
||||
|
||||
@@ -177,7 +177,6 @@ class TestMigratePreferences:
|
||||
|
||||
assert response.migrated is True
|
||||
assert response.settings.preferences_migrated is True
|
||||
assert response.settings.sidebar_sort_order == "alpha"
|
||||
assert len(response.settings.favorites) == 1
|
||||
assert response.settings.favorites[0].type == "contact"
|
||||
assert response.settings.favorites[0].id == "aa" * 32
|
||||
|
||||
Reference in New Issue
Block a user