def test_leave(self): """ convenience: should Hangup to a url via POST """ r = VoiceResponse() r.leave() assert_equal( self.strip(r), '<?xml version="1.0" encoding="UTF-8"?><Response><Leave /></Response>' )
def test_response(self): r = VoiceResponse() r.hangup() r.leave() r.sms('twilio sms', to='+11234567890', from_='+10987654321') assert_equal( self.strip(r), '<?xml version="1.0" encoding="UTF-8"?><Response><Hangup /><Leave /><Sms from="+10987654321" to="+11234567890">twilio sms</Sms></Response>' )
from twilio.twiml.voice_response import Leave, VoiceResponse response = VoiceResponse() response.leave() print(response)