Skip to content

Commit b2ebaee

Browse files
committed
wip
1 parent d61c41b commit b2ebaee

File tree

1 file changed

+29
-11
lines changed

1 file changed

+29
-11
lines changed

plugins/twilio/tests/test_twilio.py

Lines changed: 29 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
from dotenv import load_dotenv
33

44
from vision_agents.plugins import twilio
5+
from vision_agents.plugins.twilio import CallWebhookInput
56

67

78
load_dotenv()
@@ -18,14 +19,20 @@ def test_import(self):
1819
class TestTwilioCall:
1920
def test_create_call(self):
2021
"""Test creating a TwilioCall."""
22+
webhook_data = CallWebhookInput(
23+
CallSid="CA123456",
24+
AccountSid="AC123",
25+
CallStatus="ringing",
26+
Direction="inbound",
27+
From="+1234567890",
28+
Caller="+1234567890",
29+
CallerCity="New York",
30+
To="+0987654321",
31+
Called="+0987654321",
32+
)
2133
call = twilio.TwilioCall(
2234
call_sid="CA123456",
23-
form_data={
24-
"From": "+1234567890",
25-
"To": "+0987654321",
26-
"CallStatus": "ringing",
27-
"CallerCity": "New York",
28-
}
35+
webhook_data=webhook_data,
2936
)
3037

3138
assert call.call_sid == "CA123456"
@@ -48,9 +55,20 @@ class TestTwilioCallRegistry:
4855
def test_create_and_get(self):
4956
"""Test creating and retrieving calls."""
5057
registry = twilio.TwilioCallRegistry()
58+
webhook_data = CallWebhookInput(
59+
CallSid="CA123",
60+
AccountSid="AC123",
61+
CallStatus="ringing",
62+
Direction="inbound",
63+
From="+123",
64+
Caller="+123",
65+
To="+456",
66+
Called="+456",
67+
)
5168

52-
call = registry.create("CA123", {"From": "+123"})
69+
call = registry.create("CA123", webhook_data=webhook_data)
5370
assert call.call_sid == "CA123"
71+
assert call.from_number == "+123"
5472

5573
retrieved = registry.get("CA123")
5674
assert retrieved is call
@@ -63,7 +81,7 @@ def test_get_unknown(self):
6381
def test_remove(self):
6482
"""Test removing a call."""
6583
registry = twilio.TwilioCallRegistry()
66-
registry.create("CA123", {})
84+
registry.create("CA123")
6785

6886
removed = registry.remove("CA123")
6987
assert removed is not None
@@ -73,9 +91,9 @@ def test_remove(self):
7391
def test_list_active(self):
7492
"""Test listing active calls."""
7593
registry = twilio.TwilioCallRegistry()
76-
registry.create("CA1", {})
77-
registry.create("CA2", {})
78-
registry.create("CA3", {})
94+
registry.create("CA1")
95+
registry.create("CA2")
96+
registry.create("CA3")
7997

8098
# End one call
8199
registry.remove("CA2")

0 commit comments

Comments
 (0)