def dogen(self): if bccclt.init(CustInfoGen.SVRIP,CustInfoGen.SVRPORT,0,'cpack.dat') <> 0: print "init bccclt error" return a = raw_input("是否删除原始客户表数据(Y/n) :") if a in ('Y','y') or a == '' : print "删除原始数据..." self.doInsertIntoDB("delete from t_customer") self.doInsertIntoDB("delete from t_card") self.doInsertIntoDB("delete from t_carddtl") self.connect.commit() if not self.doGenUserCard(): self.connect.rollback() return print "提交数据库..." self.connect.commit() print "正在卡缴费..." self.doPayCard() print "缴费完成"
def setUp(self): if bccclt.init('172.16.0.60',4000,1,'d:/cpack.dat') <> 0: print "init bccclt error"
ret = obj.callsvr(850011,v,5000) self.failUnless(ret==0,obj.errmsg) x = obj.getrecord(['lvol0','lvol4','lvol5','damt0','sdate0','stime0']) #print x self.failUnless(x['lvol4']==0,'交易金额不正确') self.failUnless(x['lvol5']==5000,'出卡金额不正确') self.failUnless(x['damt0']==5000/100.0,'出卡金额不正确') def testPayWithSerial(self): """ 测试有流水补扣 """ obj = bccclt.new(common.MAINFUNC) v = {'lvol0':7,'semp':'1000','lvol1':97501,'lvol2':45,'sphone':'0022100807','sdate0':'20100826','stime0':'193152', 'sstation0':'D19EE170','lvol3':45} ret = obj.callsvr(850011,v,5000) self.failUnless(ret==0,obj.errmsg) x = obj.getrecord(['lvol0','lvol4','lvol5','damt0','sdate0','stime0']) print x self.failUnless(x['lvol4']==20,'交易金额不正确') self.failUnless(x['lvol5']==5000-20,'出卡金额不正确') self.failUnless(x['damt0']==(5000-30)/100.0,'出卡金额不正确') def suite(): suites = ['testPay','testPayUnlock','testPayWithSerial'] return unittest.TestSuite(map(test_850011,suites)) if __name__ == "__main__": if bccclt.init(common.TESTSVRIP,common.TESTSVRPORT,common.DEBUGBCC,common.XPACKDATA) <> 0: print "init bccclt error" unittest.main()
def testDownloadSubsidy(self): """ ÏÂÔز¹Öú """ obj = bccclt.new(6000) v = { "semp":"system", "sstatus0":"A", "scust_limit":"wenjian²âÊÔÕ¾µã", "sphone":"192.168.113.1" } ret = obj.callsvr(849007,v) self.failUnless(ret==0,obj.errmsg) def GetSubsidy(self): """ ÁìÈ¡²¹Öú """ obj = bccclt.new(6000) v = { "lvol0":292214, "lvol3":0, "lvol5":380547 } ret = obj.callsvr(849006,v) self.failUnless(ret==0,obj.errmsg) def suite(): suites = ['testDownloadSubsidy'] return unittest.TestSuite(map(paymentTest,suites)) if __name__ == "__main__": if bccclt.init(common.TESTSVRIP,common.TESTSVRPORT,common.DEBUGBCC,common.XPACKDATA) <> 0: print "init bccclt error" unittest.main()
v = { "sstatus0":"K", "lsafe_level":11, "semp":"1000", "lserial0":3, } ret = obj.callsvr(850050,v) self.failUnless(ret==0,obj.errmsg) def testVoucherEntry(self): """ 测试凭证入账功能 """ obj = bccclt.new(common.MAINFUNC) v = { "sstatus0":"B", "lsafe_level":11, "semp":"1000", "lserial0":3, } ret = obj.callsvr(850050,v) self.failUnless(ret==0,obj.errmsg) def suite(): #suites = ['testVoucherMake'] #suites = ['VoucherCheck'] #suites = ['VoucherMake'] return unittest.TestSuite(map(voucherTest,suites)) if __name__ == "__main__": if bccclt.init("vmlinux",common.TESTSVRPORT,common.DEBUGBCC,common.XPACKDATA) <> 0: print "init bccclt error" runner = unittest.TextTestRunner(verbosity=2) unittest.main(testRunner=runner)
def tearDown(self): pass def testGetSubsidy(self): """ 测试查询卡信息 """ obj = bccclt.new(6000) v = { "lwithdraw_flag":1220, 'lvol0':81, 'lvol5':5, # 充值次数 'lvol6':295, # 消费次数 'lvol7':11981, # 入卡值 } ret = obj.callsvr(846318,v,8000) self.failUnless(ret==0,obj.errmsg) x = obj.getrecord(['lvol0','lvol8','sdate3','lwithdraw_flag','lserial1','damt0','vsmess']) print x def suite(): suites = ['testGetSubsidy'] return unittest.TestSuite(map(GetSubsidy,suites)) if __name__ == "__main__": if bccclt.init('172.16.0.107',4000,1,'cpack.dat') <> 0: print "init bccclt error" runner = unittest.TextTestRunner(verbosity=2) unittest.main(testRunner=runner)