mirror of
https://github.com/hansjone/oclaw.git
synced 2026-10-12 15:23:27 +08:00
Notify WhatsApp requesters on access decisions and ship EN ops help.
After admin YES/NO, DM the requester a field guide; WA help/bind no longer returns the Chinese productivity todo menu. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
f31ebeb30e
commit
94a1b5b26c
5 changed files with 179 additions and 5 deletions
39
tests/test_whatsapp_ops_onboarding.py
Normal file
39
tests/test_whatsapp_ops_onboarding.py
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
from __future__ import annotations
|
||||
|
||||
from runtime.application.gateway.inbound_service import _handle_productivity_commands, _menu_text
|
||||
from runtime.extensions.whatsapp.access_control import (
|
||||
access_granted_guide_text,
|
||||
whatsapp_ops_help_text,
|
||||
)
|
||||
|
||||
|
||||
def test_whatsapp_ops_help_is_english_field_guide() -> None:
|
||||
text = whatsapp_ops_help_text(lang="en")
|
||||
assert "fiber" in text.lower() or "alarm" in text.lower()
|
||||
assert "@mention" in text.lower() or "mention" in text.lower()
|
||||
assert "记待办" not in text
|
||||
|
||||
|
||||
def test_access_granted_guide_includes_ops_help() -> None:
|
||||
text = access_granted_guide_text(lang="en")
|
||||
assert "Access approved" in text
|
||||
assert "YES" in text or "continue" in text.lower()
|
||||
|
||||
|
||||
def test_menu_text_whatsapp_not_productivity_chinese() -> None:
|
||||
text = _menu_text(channel="whatsapp")
|
||||
assert "记待办" not in text
|
||||
assert "fiber" in text.lower() or "alarm" in text.lower()
|
||||
assert "记待办" in _menu_text(channel="weixin")
|
||||
|
||||
|
||||
def test_productivity_help_on_whatsapp_returns_ops_guide() -> None:
|
||||
out = _handle_productivity_commands(
|
||||
text="help",
|
||||
tenant_id="t1",
|
||||
user_id="u1",
|
||||
channel="whatsapp",
|
||||
)
|
||||
assert out is not None
|
||||
assert "记待办" not in out
|
||||
assert "fiber" in out.lower() or "offline" in out.lower() or "alarm" in out.lower()
|
||||
Loading…
Add table
Add a link
Reference in a new issue