def test_deliver_token(self): order = createOrder(self.UserShop, self.Merch1) ws = webservice() ws.login(self.DealMgr2.username, self.DealMgr2.password) deliverOrder = ws.deliver(orderNo=order.orderNo, token='null') self.assertEqual(deliverOrder.code, 600) deliverOrder = ws.deliver(orderNo=order.orderNo, token='ErrorToken') self.assertEqual(deliverOrder.code, 100)
def test_deliver_codAgain(self): order = createOrder(self.UserShop, self.Merch1) ws = webservice() ws.login(self.DealMgr.username, self.DealMgr.password) deliverOrder = ws.deliver(orderNo=order.orderNo) self.assertEqual(deliverOrder.model['success'], '0') deliverOrderAgain = ws.deliver(orderNo=order.orderNo) self.assertEqual(deliverOrderAgain.model['success'], '1')
def test_getOrderLog_cancelAudit(self): order = createOrder(self.UserShop, self.Merch1) ws = webservice() ws.login(self.DealMgr.username, self.DealMgr.password) ws.deliver(orderNo=order.orderNo) order.ws.cancel(paymentNo=order.paymentNo, cancelType='3') ws.auditCancel(paymentNo=order.paymentNo, orderNo=order.orderNo, auditStatus='1') order.ws.cancel(paymentNo=order.paymentNo, cancelType='3') ws.auditCancel(paymentNo=order.paymentNo, orderNo=order.orderNo, auditStatus='0') orderLog = order.ws.getOrderLog(order.orderNo) self.assertEqual(orderLog['model']['success'], '0') flagCancel = 0 flagReject = 0 flagAgree = 0 for i in range(0, len(orderLog['model']['orderLogList'])): if orderLog['model']['orderLogList'][i]['dealDescrip'] == u'交易取消中': self.assertEqual( orderLog['model']['orderLogList'][i]['beforeStatus'], 'C017') self.assertIsNotNone( orderLog['model']['orderLogList'][i]['dealDate']) self.assertEqual( orderLog['model']['orderLogList'][i]['nowStatus'], 'C017') flagCancel += 1 continue if orderLog['model']['orderLogList'][i][ 'dealDescrip'] == u'卖家拒绝取消': self.assertEqual( orderLog['model']['orderLogList'][i]['beforeStatus'], 'C017') self.assertIsNotNone( orderLog['model']['orderLogList'][i]['dealDate']) self.assertEqual( orderLog['model']['orderLogList'][i]['nowStatus'], 'C017') flagReject += 1 continue if orderLog['model']['orderLogList'][i]['dealDescrip'] == u'交易已取消': self.assertEqual( orderLog['model']['orderLogList'][i]['beforeStatus'], 'C017') self.assertIsNotNone( orderLog['model']['orderLogList'][i]['dealDate']) self.assertEqual( orderLog['model']['orderLogList'][i]['nowStatus'], 'C012') flagAgree += 1 continue self.assertEqual(flagCancel, 2, order.orderNo + 'cancel time is wrong!') self.assertEqual(flagReject, 1, order.orderNo + 'cancel reject time is wrong!') self.assertEqual(flagAgree, 1, order.orderNo + 'cancel agree time is wrong!')
def test_auditCancel_agree(self): order = createOrder(self.UserShop, self.Merch1) ws = webservice() ws.login(self.DealMgr.username, self.DealMgr.password) ws.deliver(orderNo=order.orderNo) order.ws.cancel(paymentNo=order.paymentNo, cancelType='3') auditCancel = ws.auditCancel(paymentNo=order.paymentNo, orderNo=order.orderNo, auditStatus='0') self.assertEqual(auditCancel.model['success'], '0')
def test_cancel_onlineNoPay(self): order = createOrder(self.UserShop, self.Merch1, payWay='1') cancelOrder = order.ws.cancel(paymentNo=order.paymentNo, payType='1', cancelType='1') self.assertEqual(cancelOrder.model['success'], '0') cancelOrder = order.ws.cancel(paymentNo=order.paymentNo, payType='1', cancelType='1') self.assertEqual(cancelOrder.model['success'], '1')
def test_cancel_coddeliver(self): order = createOrder(self.UserShop, self.Merch1) ws = webservice() ws.login(self.DealMgr.username, self.DealMgr.password) ws.deliver(orderNo=order.orderNo) cancelOrder = order.ws.cancel(paymentNo=order.paymentNo, cancelType='3') self.assertEqual(cancelOrder.model['success'], '0') cancelOrder = order.ws.cancel(paymentNo=order.paymentNo, cancelType='3') self.assertEqual(cancelOrder.model['success'], '1')
def test_getOrderLog_changPrice(self): order = createOrder(self.UserShop, self.Merch1) ws = webservice() ws.login(self.DealMgr.username, self.DealMgr.password) ws.changeOrderPrice(orderNo=order.orderNo, orderDiscountAmount='100', orderChangeAmount='11900', orderStatus='C020') ws.deliver(orderNo=order.orderNo) orderLog = order.ws.getOrderLog(order.orderNo) self.assertEqual(orderLog['model']['success'], '0') flag = 0 for i in range(0, len(orderLog['model']['orderLogList'])): if orderLog['model']['orderLogList'][i]['beforeStatus'] == 'C020': self.assertIsNotNone( orderLog['model']['orderLogList'][i]['dealDate']) self.assertEqual( orderLog['model']['orderLogList'][i]['dealDescrip'], u'卖家发货') self.assertEqual( orderLog['model']['orderLogList'][i]['nowStatus'], 'C017') flag += 1 self.assertEqual(flag, 1, 'cancel order log is not found or is found twice')
def test_separateOrder_separat(self): order = createOrder(self.UserShop, self.Merch) sepOrder = self.wsDealMager.separateOrder( orderNo=order.orderNo, separateOrderAmount=[str(int(order.price) - 100), '100']) self.assertSepOrder(sepOrder, order)
def initOrder(): UserShop = eData('TmlShop') Merch = eData('Merch1') #Merch4 = eData('Merch4') DealMgr = eData('DealMager') ws = webservice() ws.login(DealMgr.username, DealMgr.password) #在线支付待付款订单(C011) orderOnlineWaitPay = createOrder(UserShop, Merch, payWay='1') orderOnlineWaitPay.pop('ws') write_excel(sheetname='TmlShop', rowkey='orderOnlineWaitPay', rowvalue=str(orderOnlineWaitPay)) import datetime update( 'update dlorder.dl_order_orderinfo SET gmt_created = ? WHERE order_no = ?', datetime.datetime.strptime('2099-01-01 00:00:00', "%Y-%m-%d %H:%M:%S"), orderOnlineWaitPay.orderNo) #在线支付待发货订单 #在线支付待收货订单 #在线支付交易完成订单 #在线支付已取消订单(C012) orderOnlienCancel = createOrder(UserShop, Merch, payWay='1') orderOnlienCancelWS = orderOnlienCancel.pop('ws') write_excel(sheetname='TmlShop', rowkey='orderOnlienCancel', rowvalue=str(orderOnlienCancel)) orderOnlienCancelWS.cancel(paymentNo=orderOnlienCancel.paymentNo, payType='1', cancelType='1') #货到付款待发货订单(C020) orderCodWaitDeliver = createOrder(UserShop, Merch) orderCodWaitDeliver.pop('ws') write_excel(sheetname='TmlShop', rowkey='orderCodWaitDeliver', rowvalue=str(orderCodWaitDeliver)) #货到付款待收货订单(C017) orderCodWaitReceive = createOrder(UserShop, Merch) orderCodWaitReceive.pop('ws') write_excel(sheetname='TmlShop', rowkey='orderCodWaitReceive', rowvalue=str(orderCodWaitReceive)) ws.deliver(orderNo=orderCodWaitReceive.orderNo) #货到付款已完成订单(C019) orderCodComplete = createOrder(UserShop, Merch) orderCodComplete.pop('ws') write_excel(sheetname='TmlShop', rowkey='orderCodComplete', rowvalue=str(orderCodComplete)) ws.deliver(orderNo=orderCodComplete.orderNo) codPay(orderNo=orderCodComplete.orderNo) #货到付款已取消订单(C012) orderCodCancel = createOrder(UserShop, Merch) orderCodCancelWS = orderCodCancel.pop('ws') write_excel(sheetname='TmlShop', rowkey='orderCodCancel', rowvalue=str(orderCodCancel)) orderCodCancelWS.cancel(paymentNo=orderCodCancel.paymentNo)
def test_cancel_again(self): order = createOrder(self.UserShop, self.Merch1) cancelOrder = order.ws.cancel(paymentNo=order.paymentNo) self.assertEqual(cancelOrder.model['success'], '0') cancelOrder = order.ws.cancel(paymentNo=order.paymentNo) self.assertEqual(cancelOrder.model['success'], '1')