Esempio n. 1
0
 def testMakeFreetextMessage(self):
     vmr = VodacomMessagingResponse(self.web_host, self.web_path)
     vmr.set_headertext("Please enter your name")
     vmr.accept_freetext()
     ref = '''
         <request>
             <headertext>Please enter your name</headertext>
             <options>
                 <option
                     callback="http://vumi.p.org/api/v1/ussd/vmes/"
                     command="1"
                     display="False"
                     order="1" />
             </options>
         </request>
         '''
     self.assertEquals(self.stdXML(vmr), self.stdXML(ref))
     ref = '''
     <request>
         <headertext>Please enter your name</headertext>
         <options>
         <option
             callback="http://vumi.p.org/api/v1/ussd/vmes/"
             command="1"
             display="False"
             order="1" />
         </options>
     </request>
     '''
     self.assertEquals(self.stdXML(vmr), self.stdXML(ref))
Esempio n. 2
0
 def testMakeOrderedOptionMessage(self):
     vmr = VodacomMessagingResponse(self.web_host, self.web_path)
     vmr.set_headertext("Pick a card")
     vmr.accept_freetext()
     vmr.add_option("3 of hearts", 3)
     vmr.add_option("2 of clubs", 2)
     vmr.add_option("Ace of diamonds", 1)
     ref = '''
         <request>
             <headertext>Pick a card</headertext>
             <options>
                 <option
                     command="3"
                     order="3"
                     callback="http://vumi.p.org/api/v1/ussd/vmes/"
                     display="True"
                     >3 of hearts</option>
                 <option
                     command="2"
                     order="2"
                     callback="http://vumi.p.org/api/v1/ussd/vmes/"
                     display="True"
                     >2 of clubs</option>
                 <option
                     command="1"
                     order="1"
                     callback="http://vumi.p.org/api/v1/ussd/vmes/"
                     display="True"
                     >Ace of diamonds</option>
             </options>
         </request>
         '''
     self.assertEquals(self.stdXML(vmr), self.stdXML(ref))
Esempio n. 3
0
 def testMakeEndMessage(self):
     vmr = VodacomMessagingResponse(self.web_host, self.web_path)
     vmr.set_headertext("Goodbye")
     ref = '''
         <request>
             <headertext>Goodbye</headertext>
         </request>
         '''
     self.assertEquals(self.stdXML(vmr), self.stdXML(ref))