tests/xmlrpc.py
branchdevel
changeset 120 7bde35ad89e0
parent 119 3462c2c90f95
child 125 19b3f383c9ce
equal deleted inserted replaced
119:3462c2c90f95 120:7bde35ad89e0
   140             u.rights.append(Userright(o)) 
   140             u.rights.append(Userright(o)) 
   141         
   141         
   142         self.failUnlessEqual(self.__rpc2().routes('abcdef123456789','sms'),['sipgate_basic','sipgate_plus'])
   142         self.failUnlessEqual(self.__rpc2().routes('abcdef123456789','sms'),['sipgate_basic','sipgate_plus'])
   143         self.failUnlessEqual(self.__rpc2().routes('abcdef123456789','fax'),['faxde'])
   143         self.failUnlessEqual(self.__rpc2().routes('abcdef123456789','fax'),['faxde'])
   144 
   144 
       
   145     def testDefaultRoutes(self):
       
   146         '''test the defaultRoute function'''
       
   147         with WithSession(md.engine, autocommit=True) as session:
       
   148             u=User(name='test',apikey='abcdef123456789')
       
   149             o=Offer(name="sipgate_basic", provider="sipgate", route="basic", typ="sms")
       
   150             u.rights.append(Userright(o,True)) 
       
   151             o=Offer(name="sipgate_plus", provider="sipgate", route="plus", typ="sms")
       
   152             u.rights.append(Userright(o))
       
   153             session.add(u)
       
   154         self.failUnlessEqual(self.__rpc2().defaultRoute('abcdef123456789','sms'),['sipgate_basic'])
       
   155 
       
   156 
       
   157 
   145 def startReactor(engine):
   158 def startReactor(engine):
   146     """starts the Rector with a special debug Clild, so that the reactor can be stopped remotly. """
   159     """starts the Rector with a special debug Clild, so that the reactor can be stopped remotly. """
   147     from twisted.internet import reactor
   160     from twisted.internet import reactor
   148     from twisted.web import xmlrpc, resource
   161     from twisted.web import xmlrpc, resource
   149     
   162