Пример #1
0
 def get_depend_key(self,depend_key,data,json_str):
     if depend_key:
         list_depend = depend_key.split()
         list_data = list_depend[0].split(',')
         for data_depend in list_data:
             data[data_depend] = OpreationGloabalVar.get_value(data_depend)
         if len(list_depend) > 1 and json_str:
             for json_depend in list_depend[1].split(','):
                 json_str[json_depend] = OpreationGloabalVar.get_value(json_depend)
Пример #2
0
 def test_002_(self):
     datas = {
         "token": OpreationGloabalVar.get_value('token'),
         "uid": OpreationGloabalVar.get_value('uid'),
     }
     url = self.url + 'XXXXXX'
     r = requests.post(url=url, data=datas)
     self.assertEqual(r.status_code, 200)
     response = r.json()
     self.assertEqual(response['code'], '0000')
     account.get_user_headimgurl(response)
Пример #3
0
 def test_003_invoice_getInvoiceList(self):
     params = {
         "token": OpreationGloabalVar.get_value('token'),
     }
     headers = {}
     url = self.url + 'XXXXXXX'
     r = requests.post(url, data=params, headers=headers)
     self.assertEqual(r.status_code, 200)
     invoice_Analyze = InvoiceListAnalyze(r.json())
     invoiceIds, trafficIds = invoice_Analyze.get_invoiceids_string()
     OpreationGloabalVar.set_value('invoiceIds', invoiceIds)
     OpreationGloabalVar.set_value('trafficIds', trafficIds)
Пример #4
0
 def response_deal(self,deal_method,res):
     if deal_method:
         if 'deal_default' in deal_method:
             if re.findall('\((.*)\)', deal_method)[0].split(',') == ['']:
                 OGV = OpreationGloabalVar({})
                 OpreationGloabalVar.push_global_dict(OGV.deal_data(res.json()))
             else:
                 OGV = OpreationGloabalVar({})
                 dict = OGV.deal_data(res.json(), None, re.findall('\((.*)\)', deal_method)[0].split(','))
                 OpreationGloabalVar.push_global_dict(dict)
         else:
             get_function(deal_method, res.json())
Пример #5
0
 def test_001_(self):
     params = config.GLOBAL_USER_INFO
     url = self.url + 'XXXXXX'
     r = requests.post(url=url, params=params)
     self.assertEqual(r.status_code, 200)
     response = r.json()
     self.assertEqual(response['code'], '0000')
     global account
     account = Account(response)
     token, uid = account.get_logininfor()
     #将获得的token uid 设为全局变量
     OpreationGloabalVar.set_value('token', token)
     OpreationGloabalVar.set_value('uid', uid)
Пример #6
0
 def test_004_downloadImg(self):
     url = self.url + 'XXXXXXX/' + OpreationGloabalVar.get_value(
         'head_img_url')
     r = requests.get(url=url, stream=True)
     f = open('a', 'wb')
     for chunk in r.iter_content(chunk_size=512):
         if chunk:
             f.write(chunk)
     f.close()
Пример #7
0
 def test_003_(self):
     headers = {"Content-Type": "Application/json"}
     params = {"token": OpreationGloabalVar.get_value('token')}
     img_base64 = Account.get_img_base64()
     datas = {
         "": "1",
         "": Account.Unicode(),
         "": Account.Unicode(),
         "": "中国",
         "": "北京",
         "": Account.GBK2312(),
         "": OpreationGloabalVar.get_value('uid'),
         "": img_base64
     }
     url = self.url + 'XXXXXXX'
     r = requests.post(url=url, headers=headers, json=datas, params=params)
     self.assertEqual(r.status_code, 200)
     response = r.json()
     self.assertEqual(response['code'], '0000')
     print(r.json())
Пример #8
0
 def test_001_invoice_qrcheck(self):
     for invoice in config.GLOBAL_INVOICE_LIST:
         params = {
             "flag": "1",
             "token": OpreationGloabalVar.get_value('token'),
             #"infoStr": {",,031001600411,12357700,,,,"},
             "uuid": "",
         }
         url = self.url + 'XXXXXXXXX'
         r = requests.post(url, params=params)
         self.assertEqual(r.status_code, 200)
         res = r.json()
         self.assertEqual(res['code'], '0000')
         print(r.json())
Пример #9
0
 def test_002_invoice_ocr_trafficInvoiceCollection(self):
     for traffic in config.GLOBAL_TRAFFIC_LIST:
         params = {"token": OpreationGloabalVar.get_value('token')}
         headers = {
             'Accept': "Application/json",
             'Content-Type': "application/json"
         }
         #payload = "{\r\n\"invoice_type\": \"3\",\r\n\"je\": \"35.00\",\r\n\"kprq\": \"2017-09-15 08:20:30\",\r\n\"name\": \"dachepiao\",\r\n\"train_time\": \"2017-09-15 08:20:30\",\r\n\"uuid\": \"\"\r\n}"
         payload = traffic
         url = self.url + 'XXXXXXXXX'
         r = requests.post(url,
                           params=params,
                           headers=headers,
                           json=payload)
         self.assertEqual(r.status_code, 200)
         res = r.json()
         self.assertEqual(res['code'], '0000')
         print(r.json())
Пример #10
0
def deal_login_data(data):
    account = Account(data)
    token,uid = account.get_logininfor()
    globalvar.set_value('token',token)
    globalvar.set_value('uid',uid)