Fix Signal messages and replies
This commit is contained in:
@@ -6,6 +6,7 @@ from django.test import TestCase
|
||||
from core.commands.base import CommandContext
|
||||
from core.commands.engine import _matches_trigger, process_inbound_message
|
||||
from core.messaging.reply_sync import extract_reply_ref, resolve_reply_target
|
||||
from core.views.compose import _command_options_for_channel
|
||||
from core.models import (
|
||||
ChatSession,
|
||||
CommandChannelBinding,
|
||||
@@ -123,6 +124,27 @@ class Phase1ReplyResolutionTests(TestCase):
|
||||
self.assertEqual("signal-msg-quoted", result.get("reply_source_message_id"))
|
||||
self.assertEqual("signal", result.get("reply_source_service"))
|
||||
|
||||
def test_extract_reply_ref_signal_target_sent_timestamp_variant(self):
|
||||
result = extract_reply_ref(
|
||||
"signal",
|
||||
{
|
||||
"envelope": {
|
||||
"dataMessage": {
|
||||
"quote": {
|
||||
"targetSentTimestamp": 1772545268786,
|
||||
"authorNumber": "+15550000001",
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
)
|
||||
self.assertEqual(
|
||||
"1772545268786",
|
||||
result.get("reply_source_message_id"),
|
||||
)
|
||||
self.assertEqual("signal", result.get("reply_source_service"))
|
||||
self.assertEqual("+15550000001", result.get("reply_source_chat_id"))
|
||||
|
||||
def test_extract_reply_ref_whatsapp(self):
|
||||
result = extract_reply_ref(
|
||||
"whatsapp",
|
||||
@@ -272,3 +294,23 @@ class Phase1CommandEngineTests(TestCase):
|
||||
self.assertEqual(1, len(results))
|
||||
self.assertEqual("skipped", results[0].status)
|
||||
self.assertEqual("reply_required", results[0].error)
|
||||
|
||||
def test_compose_command_options_show_bp_subcommands(self):
|
||||
self.profile.channel_bindings.all().delete()
|
||||
CommandChannelBinding.objects.create(
|
||||
profile=self.profile,
|
||||
direction="ingress",
|
||||
service="whatsapp",
|
||||
channel_identifier="120363402761690215@g.us",
|
||||
enabled=True,
|
||||
)
|
||||
options = _command_options_for_channel(
|
||||
self.user,
|
||||
"whatsapp",
|
||||
"120363402761690215@g.us",
|
||||
)
|
||||
names = [str(row.get("name") or "").strip().lower() for row in options]
|
||||
self.assertIn("bp", names)
|
||||
self.assertIn("bp set", names)
|
||||
self.assertIn("bp set range", names)
|
||||
self.assertNotIn("announce task ids", names)
|
||||
|
||||
Reference in New Issue
Block a user