8000 Return self on TwiML append · raghav7997/twilio-python@c374d0b · GitHub
[go: up one dir, main page]

Skip to content

Commit c374d0b

Browse files
committed
Return self on TwiML append
1 parent 041760d commit c374d0b

File tree

3 files changed

+21
-1
lines changed

3 files changed

+21
-1
lines changed

tests/unit/twiml/test_messaging_response.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,14 @@ def test_response(self):
2222
'<?xml version="1.0" encoding="UTF-8"?><Response><Message>Hello</Message><Redirect url="example.com" /></Response>'
2323
)
2424

25+
def test_response_chain(self):
26+
r = MessagingResponse().message('Hello').redirect(url='example.com')
27+
28+
assert_equal(
29+
self.strip(r),
30+
'<?xml version="1.0" encoding="UTF-8"?><Response><Message>Hello</Message><Redirect url="example.com" /></Response>'
31+
)
32+
2533

2634
class TestMessage(TwilioTest):
2735

tests/unit/twiml/test_voice_response.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,18 @@ def test_response(self):
2929
'<?xml version="1.0" encoding="UTF-8"?><Response><Hangup /><Leave /><Sms from="+10987654321" to="+11234567890">twilio sms</Sms></Response>'
3030
)
3131

32+
def test_response_chain(self):
33+
r = VoiceResponse().hangup().leave().sms(
34+
'twilio sms',
35+
to='+11234567890',
36+
from_='+10987654321'
37+
)
38+
39+
assert_equal(
40+
self.strip(r),
41+
'<?xml version="1.0" encoding="UTF-8"?><Response><Hangup /><Leave /><Sms from="+10987654321" to="+11234567890">twilio sms</Sms></Response>'
42+
)
43+
3244

3345
class TestSay(TwilioTest):
3446

twilio/twiml/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,4 +73,4 @@ def xml(self):
7373

7474
def append(self, verb):
7575
self.verbs.append(verb)
76-
return verb
76+
return self

0 commit comments

Comments
 (0)
0