예제 #1
0
 def test_00_login(self):
     t = DataSource().getAllyaml('Logining')
     url = str(t.get('urls'))
     data = dict(t.get('data'))
     try:
         data['mobile'] = self.locust.queueData.get()
         print(data)
     except queue.Empty:
         print('no data exit')
         exit(0)
     headers = {
         "Content-Type":
         'application/x-www-form-urlencoded; charset=UTF-8',
         "Host":
         'bms-3.yzwill.cn',
         "User-Agent":
         "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, likeGecko) Chrome/73.0.3683.86 Safari/537.36"
     }
     response = self.client.post(url=url,
                                 data=data,
                                 headers=headers,
                                 verify=False)
     print(response.text)
     if response.status_code == 200:
         print("success")
     else:
         print("fails")
예제 #2
0
 def test_00_login(self):
     t = DataSource().getAllyaml('Logining')
     url = str(t.get('urls'))
     data = dict(t.get('data'))
     headers = {
         "Content-Type":
         'application/x-www-form-urlencoded; charset=UTF-8',
         "Host":
         'bms-3.yzwill.cn',
         "User-Agent":
         "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, likeGecko) Chrome/73.0.3683.86 Safari/537.36"
     }
     req = self.client.post(url=url,
                            data=data,
                            headers=headers,
                            verify=False)
     if req.status_code == 200:
         print("success")
     else:
         print("fails")