Commit 33071ed7ee836bad33a54077da1531c95493c2c7

Authored by wenleiming
2 parents 55429fd2 413ebc24

Merge remote-tracking branch 'origin/master'

commons/api/duplicateToken.py
@@ -24,10 +24,9 @@ class duplicateToken(): @@ -24,10 +24,9 @@ class duplicateToken():
24 self.header["Host"] = com.get_global_config("global_data", "host", "gateway") 24 self.header["Host"] = com.get_global_config("global_data", "host", "gateway")
25 25
26 def jmsf_duplicate_commit_token(self): 26 def jmsf_duplicate_commit_token(self):
27 - re = sy1.get(url=self.url, headers=self.header,proxies=my.myproxies) 27 + re = sy1.get(url=self.url, headers=self.header)
28 return re.json()["data"] 28 return re.json()["data"]
29 29
30 30
31 # du=duplicateToken() 31 # du=duplicateToken()
32 -# du.jmsf_duplicate_commit_token()  
33 # print(du.jmsf_duplicate_commit_token()) 32 # print(du.jmsf_duplicate_commit_token())
commons/api/weighingServiceSave.py
@@ -53,6 +53,7 @@ class weighingServiceSave(): @@ -53,6 +53,7 @@ class weighingServiceSave():
53 53
54 54
55 55
  56 +
56 # tt=weighingServiceSave() 57 # tt=weighingServiceSave()
57 # re=sy1.post(url=tt.url,headers=tt.header,json=tt.body,proxies=my.myproxies) 58 # re=sy1.post(url=tt.url,headers=tt.header,json=tt.body,proxies=my.myproxies)
58 -# # print(re.json())  
59 \ No newline at end of file 59 \ No newline at end of file
  60 +# print(re.json())
60 \ No newline at end of file 61 \ No newline at end of file
commons/basic/__init__.py 0 → 100644
commons/basic/listCarType.py 0 → 100644
  1 +#!/usr/bin/python
  2 +# -*- coding: UTF-8 -*-
  3 +import urllib3
  4 +from commons import common as com
  5 +from commons.MySession import my,sy1,sy2
  6 +urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
  7 +
  8 +
  9 +class listCarType():
  10 + url = "http://test.gateway.diligrp.com:8285/jmsf-web/api/jmsf/query/listCarType"
  11 + header = {
  12 + "UAP_accessToken": "demo",
  13 + "UAP_refreshToken": "demo",
  14 + "UAP_firmId": "9",
  15 + "Content-Type": "application/json",
  16 + "Host": "test.gateway.diligrp.com:8285",
  17 + "Content-Length": "23"}
  18 + body = {"businessCode":"jmsf"}
  19 +
  20 + def __init__(self):
  21 + self.url = listCarType.url.replace("http://test.", com.get_global_config("global_data", "environment", "en"))
  22 + self.header = listCarType.header
  23 + self.header["UAP_accessToken"] = sy1.cookies["UAP_accessToken"]
  24 + self.header["UAP_refreshToken"] = sy1.cookies["UAP_refreshToken"]
  25 + self.header["UAP_firmId"] = sy1.cookies["UAP_firmId"]
  26 + self.header["Host"] = com.get_global_config("global_data", "host", "gateway")
  27 +
  28 + def car_list(self):
  29 + re = sy1.post(url=self.url, headers=self.header,json=self.body)
  30 + return re.json()
  31 +
  32 +# tt=listCarType()
  33 +# print(tt.car_list())
0 \ No newline at end of file 34 \ No newline at end of file
config/global_data.conf
@@ -21,8 +21,8 @@ demo=["tg@diligrp.com","175930106@qq.com"] @@ -21,8 +21,8 @@ demo=["tg@diligrp.com","175930106@qq.com"]
21 21
22 [mark] 22 [mark]
23 #为空时[]运行所有用例,若要运行指定用例,参考demo 23 #为空时[]运行所有用例,若要运行指定用例,参考demo
24 -list=["heb1","P3","v1.6","沈阳"]  
25 -demo=["p1","P2",1,"test"] 24 +list=[]
  25 +demo=["heb1","P3","v1.6","沈阳",None]
26 26
27 27
28 [environment] 28 [environment]
testcase/weightBizBill/test_weighingServiceSave.py 0 → 100644
  1 +#!/usr/bin/python
  2 +# -*- coding: UTF-8 -*-
  3 +import unittest
  4 +import urllib3
  5 +from commons.MySession import my,sy1
  6 +from commons.api.weighingServiceSave import weighingServiceSave
  7 +from commons.basic.listCarType import listCarType
  8 +urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
  9 +we=weighingServiceSave()
  10 +li=listCarType()
  11 +
  12 +
  13 +
  14 +class test_weighingServiceSave(unittest.TestCase):
  15 + "称重服务"
  16 +
  17 + @unittest.case_mark(my.mark())
  18 + def test_weighingServiceSave_01(self):
  19 + "称重服务-称重服务:成功新增一条称重服务单"
  20 + body=we.body.copy()
  21 + body["carTypeId"]=li.car_list()["data"][0]["id"]
  22 + body["carTypeName"]=li.car_list()["data"][0]["carTypeName"]
  23 + body["carTypeCode"]=li.car_list()["data"][0]["code"]
  24 + re=sy1.post(url=we.url,headers=we.header,json=body)
  25 + print(re.json())
  26 + self.assertEqual(re.status_code, 200)
  27 + self.assertTrue("'message':'交费成功','result':'交费成功','success':True" in str(re.json()).replace(" ",""))
  28 +
  29 +
  30 +if __name__ == "__main__":
  31 +
  32 + unittest.main(verbosity=2)
  33 +
  34 + # com.run_one(test_weighingServiceSave("test_weighingServiceSave_01"))