Ejemplo n.º 1
0
 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>'
     )
Ejemplo n.º 2
0
 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(""))
Ejemplo n.º 3
0
 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())
Ejemplo n.º 4
0
    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
Ejemplo n.º 5
0
 def testBadAppend(self):
     """ should raise exceptions for wrong appending"""
     self.improperAppend(twilio.Conference("Hello"))
Ejemplo n.º 6
0
 def testAddAttribute(self):
     """add attribute"""
     r = twilio.Conference("MyRoom", foo="bar")
     r = self.strip(r)
     self.assertEquals(r, '<Conference foo="bar">MyRoom</Conference>')