def testAddConference(self): """ add a conference to a dial""" r = twilio.Response() d = twilio.Dial() d.append(twilio.Conference("My Room")) r.append(d) r = self.strip(r) self.assertEquals( r, '<Response><Dial><Conference>My Room</Conference></Dial></Response>' )
def testImproperNesting(self): """ bad nesting""" verb = twilio.Gather() self.assertRaises(twilio.TwilioException, verb.append, twilio.Gather()) self.assertRaises(twilio.TwilioException, verb.append, twilio.Record()) self.assertRaises(twilio.TwilioException, verb.append, twilio.Hangup()) self.assertRaises(twilio.TwilioException, verb.append, twilio.Redirect()) self.assertRaises(twilio.TwilioException, verb.append, twilio.Dial()) self.assertRaises(twilio.TwilioException, verb.append, twilio.Conference("")) self.assertRaises(twilio.TwilioException, verb.append, twilio.Sms(""))
def improperAppend(self, verb): self.assertRaises(twilio.TwilioException, verb.append, twilio.Say("")) self.assertRaises(twilio.TwilioException, verb.append, twilio.Gather()) self.assertRaises(twilio.TwilioException, verb.append, twilio.Play("")) self.assertRaises(twilio.TwilioException, verb.append, twilio.Record()) self.assertRaises(twilio.TwilioException, verb.append, twilio.Hangup()) self.assertRaises(twilio.TwilioException, verb.append, twilio.Redirect()) self.assertRaises(twilio.TwilioException, verb.append, twilio.Dial()) self.assertRaises(twilio.TwilioException, verb.append, twilio.Conference("")) self.assertRaises(twilio.TwilioException, verb.append, twilio.Sms("")) self.assertRaises(twilio.TwilioException, verb.append, twilio.Pause())
def conference(self, name, muted=None, beep=None, start_on_enter=None, end_on_exit=None, wait_url=None, wait_method=None): self.last_verb = twilio_official.Conference(name, muted, beep,\ start_on_enter, end_on_exit, wait_url, wait_method) self.twilio_response.append(self.last_verb) return self
def testBadAppend(self): """ should raise exceptions for wrong appending""" self.improperAppend(twilio.Conference("Hello"))
def testAddAttribute(self): """add attribute""" r = twilio.Conference("MyRoom", foo="bar") r = self.strip(r) self.assertEquals(r, '<Conference foo="bar">MyRoom</Conference>')