summaryrefslogtreecommitdiffstats
path: root/For Weekly Test/Advance/initTestClass.py
diff options
context:
space:
mode:
Diffstat (limited to 'For Weekly Test/Advance/initTestClass.py')
-rw-r--r--For Weekly Test/Advance/initTestClass.py43
1 files changed, 28 insertions, 15 deletions
diff --git a/For Weekly Test/Advance/initTestClass.py b/For Weekly Test/Advance/initTestClass.py
index 8552e20..9270b1a 100644
--- a/For Weekly Test/Advance/initTestClass.py
+++ b/For Weekly Test/Advance/initTestClass.py
@@ -34,9 +34,10 @@ class doTest:
def initDB(self):
+ #self.db = DbClass.DBMySQLConnection('root', 'SQLrandompassword', 'localhost', 'gsmselftesting')
self.db = DbClass.DBMySQLConnection('root', 'randompasswordSQL', 'localhost', 'gsmselftesting')
- self.db.connectDB()
- self.dbStatus = self.db.connectDB()
+ self.db.connectDB()
+ self.dbStatus = self.db.connectDB()
def initaccount(self,account,handler):
if handler == 'sip' or handler == 'unisip' or handler == 'landline':
@@ -58,11 +59,11 @@ class doTest:
self.ping(callFrom)
if self.serverStatus <> 0:
- self.ping(callTo)
+ self.ping(callTo)
if self.serverStatus <> 0:
- dest = self.db.deviceAddress(str(callTo))
- caller = self.db.deviceAddress(str(callFrom))
+ dest = self.db.deviceAddress(str(callTo))
+ caller = self.db.deviceAddress(str(callFrom))
self.initaccount(caller,callFrom)
if self.status == 1:
@@ -77,7 +78,7 @@ class doTest:
makeTest = ControllerClass.doTheTest(callFrom, callPortName, accCaller, callTo, destPortName, destNo, accDest)
makeTest.FuncTest()
- self.result = str(makeTest.testResult)
+ self.result = str(makeTest.testResult)
else:
self.result = 100
else:
@@ -104,14 +105,26 @@ class doTest:
x = x+1
def smartTest(self):
- global handlerError
- smartResultList = list()
- testPendingList = list()
+ self.initDB()
+ self.smartResultList = list()
#callerList = ['sip']
- destList = ['GSMRZ1','GSMRZ2','GSMRZ3','GSMExt.O2','GSMExt.Voda','GSMExt.Eplus','GSMExt.Tm']
- gsmList = ['GSMExt.O2','GSMExt.Voda','GSMExt.Eplus','GSMExt.Tm']
- gsmRZList = ['GSMRZ1','GSMRZ2','GSMRZ3']
-
+ deviceLists = self.db.deviceList()
+ gsmList = list()
+ gsmRZList = list()
+ sipList = list()
+ print 'basil', deviceLists
+
+ for device in deviceLists:
+ if device[0:5] == 'GSMRZ':
+ gsmRZList.append(device)
+ elif device[0:5] == 'GSMEx':
+ gsmList.append(device)
+ else:
+ sipList.append(device)
+
+ if device[0:5] == 'GSMRZ' or device[0:5] == 'GSMEx':
+ destList.append(device)
+
i = random.randint(0, len(gsmRZList)-1)
callTo = gsmRZList[i]
self.initTest('unisip',callTo)
@@ -122,7 +135,7 @@ class doTest:
if openBSC == 200:
for callFrom in gsmRZList:
- i = random.randint(3, len(destList)-1) # need to check wheter the caller and dest is same
+ i = random.randint(3, len(destList)-1) # need to check whether the caller and dest are same
callTo = destList[i]
self.initTest(callFrom,callTo)
destList.remove(callTo)
@@ -138,7 +151,7 @@ class doTest:
for callTo in destList:
callFrom = 'sip'
self.initTest(callFrom,callTo)
- self.smartResultList.append([callFrom, callTo, self.result])
+ self.smartResultList.append([callFrom, callTo, self.result])
return self.smartResultList