tests/xmlrpc.py
branchdevel
changeset 120 7bde35ad89e0
parent 119 3462c2c90f95
child 125 19b3f383c9ce
--- a/tests/xmlrpc.py	Sat Jan 28 04:03:15 2012 +0100
+++ b/tests/xmlrpc.py	Sat Jan 28 04:03:46 2012 +0100
@@ -142,6 +142,19 @@
         self.failUnlessEqual(self.__rpc2().routes('abcdef123456789','sms'),['sipgate_basic','sipgate_plus'])
         self.failUnlessEqual(self.__rpc2().routes('abcdef123456789','fax'),['faxde'])
 
+    def testDefaultRoutes(self):
+        '''test the defaultRoute function'''
+        with WithSession(md.engine, autocommit=True) as session:
+            u=User(name='test',apikey='abcdef123456789')
+            o=Offer(name="sipgate_basic", provider="sipgate", route="basic", typ="sms")
+            u.rights.append(Userright(o,True)) 
+            o=Offer(name="sipgate_plus", provider="sipgate", route="plus", typ="sms")
+            u.rights.append(Userright(o))
+            session.add(u)
+        self.failUnlessEqual(self.__rpc2().defaultRoute('abcdef123456789','sms'),['sipgate_basic'])
+
+
+
 def startReactor(engine):
     """starts the Rector with a special debug Clild, so that the reactor can be stopped remotly. """
     from twisted.internet import reactor