Increase security and reformat

This commit is contained in:
2026-03-07 20:52:13 +00:00
parent 10588a18b9
commit bca4d6898f
144 changed files with 6735 additions and 3960 deletions

View File

@@ -1,8 +1,7 @@
from __future__ import annotations
import json
from unittest.mock import AsyncMock, patch
from unittest.mock import Mock
from unittest.mock import AsyncMock, Mock, patch
from asgiref.sync import async_to_sync
from django.conf import settings
@@ -175,11 +174,15 @@ class SignalInboundReplyLinkTests(TransactionTestCase):
}
async_to_sync(client._process_raw_inbound_event)(json.dumps(payload))
created = Message.objects.filter(
user=self.user,
session=self.session,
text="reply inbound s3",
).order_by("-ts").first()
created = (
Message.objects.filter(
user=self.user,
session=self.session,
text="reply inbound s3",
)
.order_by("-ts")
.first()
)
self.assertIsNotNone(created)
self.assertEqual(self.anchor.id, created.reply_to_id)
self.assertEqual("1772545458187", created.reply_source_message_id)
@@ -222,7 +225,9 @@ class SignalInboundReplyLinkTests(TransactionTestCase):
"Expected Signal heart reaction to be applied to anchor receipt payload.",
)
def test_process_raw_inbound_event_applies_sync_reaction_using_destination_fallback(self):
def test_process_raw_inbound_event_applies_sync_reaction_using_destination_fallback(
self,
):
fake_ur = Mock()
fake_ur.message_received = AsyncMock(return_value=None)
fake_ur.xmpp = Mock()
@@ -253,7 +258,7 @@ class SignalInboundReplyLinkTests(TransactionTestCase):
"emoji": "🔥",
"targetSentTimestamp": 1772545458187,
}
}
},
}
},
}
@@ -352,7 +357,9 @@ class SignalRuntimeCommandWritebackTests(TestCase):
service="signal",
identifier="+15550003000",
)
self.session = ChatSession.objects.create(user=self.user, identifier=self.identifier)
self.session = ChatSession.objects.create(
user=self.user, identifier=self.identifier
)
self.message = Message.objects.create(
user=self.user,
session=self.session,