Commit a07621797c4ea7dd49984ff61b6a3d0ac9f3bc08

Authored by lixi
2 parents f7352cd4 617a87d9

Merge remote-tracking branch 'origin/master'

commons/api/hg/transaction/createAndTrade.py
@@ -11,7 +11,6 @@ @@ -11,7 +11,6 @@
11 11
12 from commons import common as com 12 from commons import common as com
13 from commons.MySession import hg 13 from commons.MySession import hg
14 -  
15 class createAndTrade(): 14 class createAndTrade():
16 15
17 def __init__(self): 16 def __init__(self):
@@ -21,52 +20,66 @@ class createAndTrade(): @@ -21,52 +20,66 @@ class createAndTrade():
21 "UAP_refreshToken":"demo", 20 "UAP_refreshToken":"demo",
22 "Content-Type":"application/json;charset=utf-8", 21 "Content-Type":"application/json;charset=utf-8",
23 "Host":"test.gateway.diligrp.com:8285", 22 "Host":"test.gateway.diligrp.com:8285",
24 - "Content-Length":"740"} 23 + "Content-Length":"740"
  24 + }
25 self.body = { 25 self.body = {
26 - "sellerId":141962,  
27 - "sellerName":"云康飞卖",  
28 - "sellerAccountId":107663,  
29 - "sellerCardNo":"888810062816",  
30 - "buyerId":141966,  
31 - "buyerName":"严永志买",  
32 - "buyerAccountId":107675,  
33 - "buyerCardNo":"888810055039",  
34 - "posCode":"111222",  
35 - "tradePassword":"111111",  
36 - "orderItemList":[{  
37 - "number":0,  
38 - "batchCode":"2108000019",  
39 - "productId":44,  
40 - "productCode":"754107",  
41 - "productName":"葡萄",  
42 - "categoryId":754107,  
43 - "weightType":1,  
44 - "quantity":12,  
45 - "pieceWeight":50,  
46 - "grossWeight":0,  
47 - "tareWeight":0,  
48 - "weight":600,  
49 - "price":200,  
50 - "PriceStr":"2",  
51 - "amount":2400,  
52 - "amountStr":24.0,  
53 - "originId":510100,  
54 - "originName":"成都市",  
55 - "feeItemList":[{  
56 - "type":1,  
57 - "chargeItemId":521,  
58 - "chargeItemName":"买家手续费",  
59 - "amount":2  
60 - },{"type":2,  
61 - "chargeItemId":522,  
62 - "chargeItemName":"卖家手续费",  
63 - "amount":12}]}  
64 - ]  
65 - } 26 + "sellerId":141962,
  27 + "sellerName":"云云康飞卖",
  28 + "sellerAccountId":107663,
  29 + "sellerCardNo":"888810062816",
  30 + "buyerId":141968,
  31 + "buyerName":"袁豪正买",
  32 + "buyerAccountId":107676,
  33 + "buyerCardNo":"888810061104",
  34 + "posCode":"111222",
  35 + "tradePassword":"111111",
  36 + "orderItemList":[
  37 + {
  38 + "number":0,
  39 + "batchCode":"2109000215",
  40 + "productId":125,
  41 + "productCode":"374690",
  42 + "productName":"苹果",
  43 + "categoryId":374690,
  44 + "weightType":1,
  45 + "quantity":10,
  46 + "pieceWeight":1,
  47 + "grossWeight":0,
  48 + "tareWeight":0,
  49 + "weight":10,
  50 + "price":500,
  51 + "PriceStr":"5",
  52 + "amount":5000,
  53 + "amountStr":50,
  54 + "originId":510100,
  55 + "originName":"成都市",
  56 + "feeItemList":[
  57 + {
  58 + "type":1,
  59 + "chargeItemId":521,
  60 + "chargeItemName":"买家手续费",
  61 + "amount":1122
  62 + },
  63 + {
  64 + "type":2,
  65 + "chargeItemId":522,
  66 + "chargeItemName":"卖家手续费",
  67 + "amount":989
  68 + },
  69 + {
  70 + "type":2,
  71 + "chargeItemId":527,
  72 + "chargeItemName":"卖家仓储服务费",
  73 + "amount":367
  74 + }
  75 + ]
  76 + }
  77 + ]
  78 +}
66 79
67 80
68 -crat = createAndTrade()  
69 -print(crat.body)  
70 -re = hg.post(url = crat.url,json = crat.body,headers = crat.header,proxies=hg.myproxies)  
71 -print(re.json())  
72 -print(re.headers)  
73 \ No newline at end of file 81 \ No newline at end of file
  82 +# creat = createAndTrade()
  83 +# print(creat.body)
  84 +# re = hg.post(url = creat.url,json = creat.body,headers = creat.header,proxies=hg.myproxies)
  85 +# print(re.json())
  86 +# print(re.headers)
74 \ No newline at end of file 87 \ No newline at end of file
testcase/hg/tradingOrder/test_createAndTrade.py
@@ -52,25 +52,25 @@ ORDER BY @@ -52,25 +52,25 @@ ORDER BY
52 body2["customerName"] = str(cls.aaa[4]) 52 body2["customerName"] = str(cls.aaa[4])
53 body2["identityCardNo"] = str(cls.aaa[5]) 53 body2["identityCardNo"] = str(cls.aaa[5])
54 body2["mobilephoneNumber"] = str(cls.aaa[6]) 54 body2["mobilephoneNumber"] = str(cls.aaa[6])
55 - print("士大夫但是",body2)  
56 - print("水电费",cls.aaa)  
57 - print("撒地方",type(cls.aaa)) 55 + body2["categoryId"] = 44
  56 + body2["categoryCode"] = 754107
  57 + body2["categoryName"] = "葡萄"
58 re = hg.post(url = r.url, headers = r.header, json = body2,proxies = hg.proxies) 58 re = hg.post(url = r.url, headers = r.header, json = body2,proxies = hg.proxies)
59 - # 获取批号  
60 - # cls.batch = re.json()["data"]["batchCode"]  
61 - # return cls.batch 59 + "获取批号"
  60 + print("获取批号结果:",re.json())
  61 + cls.batch = re.json()["data"]["batchCode"]
  62 + return cls.batch
62 63
63 @unittest.case_mark(my.mark()) 64 @unittest.case_mark(my.mark())
64 def test_createAndTrade_01(self): 65 def test_createAndTrade_01(self):
65 "大客户创建订单" 66 "大客户创建订单"
66 body = creat.body.copy() 67 body = creat.body.copy()
67 body["orderItemList"][0]["batchCode"] = self.batch 68 body["orderItemList"][0]["batchCode"] = self.batch
  69 + print("创建订单body",body)
68 re1 = hg.post(url = creat.url, headers = creat.header, json = body,proxies = hg.proxies) 70 re1 = hg.post(url = creat.url, headers = creat.header, json = body,proxies = hg.proxies)
69 print(re1.json()) 71 print(re1.json())
70 self.assertEqual(re1.status_code, 200) 72 self.assertEqual(re1.status_code, 200)
71 self.assertTrue("'操作成功'" in str(re1.json()).replace(" ", "")) 73 self.assertTrue("'操作成功'" in str(re1.json()).replace(" ", ""))
72 -  
73 -  
74 @classmethod 74 @classmethod
75 def tearDownClass(cls): 75 def tearDownClass(cls):
76 pass 76 pass