def interface_requests_data(self, member_id, urlpart, payload): # 获取EXcel路径 self.path = Url().test_path() # 路径 url = Url().test_url() print() self.base_url = url + urlpart self.obi = Read_ExcelData() # 获取版本 self.version = Version().test_version() #获取token值 token = Token().test_token1(payload, member_id) headers = { "device": "android ", "version": self.version, "lang": "en", "timestamp": "1493780505", "token": token, "login": member_id, "serial-number": "48525687125863258471123568955554", "company": "HUAWEI", "phone-model": "P10", "system-version": "system_version" } r = requests.post(self.base_url, params=payload, headers=headers) result = r.json() return result
def testcase_001(self): date = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()) self.path = Url().test_path() self.version = Version().test_version() # 路径 url = Url().test_url() self.base_url1 = url + '/group/memberlist' payload = {"page": "1", "guid": "d4f61542-fc1f-4155-aeec-a46d44e2955f"} headers = { "device": "android", "version": "3.8.3", "lang": "en", "timestamp": "1564033489234", "token": "FkUw1pOFkUw1pOBHh7xSI8jWf0X6JuryjWHjhuMapX69FKZSVgBHh7xSI8jWf0X6JuryjWHjhuMapX69FKZSVg", "uuid": "b4156aea-a968-4722-a4fd-1123ded04736", "serial-number": "48525687125863258471123568955554", "company": "HUAWEI", "phone-model": "P10", "system-version": "8.0.0" } result = requests.post(self.base_url1, params=payload, headers=headers) result = result.json() print(result)
def testcase_001(self): date = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()) self.path = Url().test_path() self.version = Version().test_version() # 路径 url = Url().test_url() self.base_url1 = url + '/question/lists' payload = {"page": "1", "type": "qa"} headers = { "device": "android", "version": "3.9.0", "lang": "en", "timestamp": "1564033489234", "token": "FkUw1pOFkUw1pOBHh7xSI8jWf0X6JuryjWHjhuMapX69FKZSVgBHh7xSI8jWf0X6JuryjWHjhuMapX69FKZSVg", "uuid": "a5f10151-5685-4432-8c35-7198bc6511c9", "serial-number": "48525687125863258471123568955554", "company": "HUAWEI", "phone-model": "P10", "system-version": "8.0.0" } result = requests.post(self.base_url1, params=payload, headers=headers) result = result.json() print(result)
def testcase_001(self): self.path = Url().test_path() self.version = Version().test_version() # 路径 url = Url().test_url() self.base_url1 = url + '/rewards/memberLevel' payload = {} headers = { "device": "android", "version": "3.8.8", "lang": "en", "timestamp": "1564033489234", "token": "FkUw1pOFkUw1pOBHh7xSI8jWf0X6JuryjWHjhuMapX69FKZSVgBHh7xSI8jWf0X6JuryjWHjhuMapX69FKZSVg", "uuid": "b4156aea-a968-4722-a4fd-1123ded04736", "serial-number": "48525687125863258471123568955554", "company": "HUAWEI", "phone-model": "P10", "system-version": "8.0.0" } result = requests.post(self.base_url1, params=payload, headers=headers) result = result.json() print(result)
def testcase_002(self): date = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()) self.path = Url().test_path() self.version = Version().test_version() # 路径 url = Url().test_url() self.base_url1 = url + '/member/group/banAdd' payload = { "type": "unban", "member_uuid": "72e541fc-55d1-4d5d-809c-963c2255f050", "guid": "05965ae2-0979-41c1-be21-127aa5bd32cd" } headers = { "device": "android", "version": "3.8.3", "lang": "en", "timestamp": "1564033489234", "token": "FkUw1pOFkUw1pOBHh7xSI8jWf0X6JuryjWHjhuMapX69FKZSVgBHh7xSI8jWf0X6JuryjWHjhuMapX69FKZSVg", "uuid": "e1399798-f1df-4f22-aea0-da0036ee03f1", "serial-number": "48525687125863258471123568955554", "company": "HUAWEI", "phone-model": "P10", "system-version": "8.0.0" } result = requests.post(self.base_url1, params=payload, headers=headers) result = result.json() print(result)
def testcase_003(self): date = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()) self.path = Url().test_path() self.version = Version().test_version() # 路径 url = Url().test_url() self.base_url1 = url + '/member/group/banAdd' payload = { "type": "ban", "member_uuid": "84eff554-519f-4fc8-8904-8c4970046d8d", "ban_day": "1", "guid": "d4f61542-fc1f-4155-aeec-a46d44e2955f" } headers = { "device": "android", "version": "3.8.3", "lang": "en", "timestamp": "1564033489234", "token": "FkUw1pOFkUw1pOBHh7xSI8jWf0X6JuryjWHjhuMapX69FKZSVgBHh7xSI8jWf0X6JuryjWHjhuMapX69FKZSVg", "uuid": "44c20944-3bdd-4500-8784-0d198d8f66a0", "serial-number": "48525687125863258471123568955554", "company": "HUAWEI", "phone-model": "P10", "system-version": "8.0.0" } result = requests.post(self.base_url1, params=payload, headers=headers) result = result.json() print(result)
def testcase_001(self): date = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()) self.path = Url().test_path() self.version = Version().test_version() # 路径 url = Url().test_url() self.base_url1 = url + '/group/post/analyse/keyindicators' payload = { "guid": "779eba78-7ff8-4cf9-8d8b-0a82a6169a09", "start_date": "20190901", "end_date": "20190929" } headers = { "device": "android", "version": "3.8.7", "lang": "en", "timestamp": "1564033489234", "token": "FkUw1pOFkUw1pOBHh7xSI8jWf0X6JuryjWHjhuMapX69FKZSVgBHh7xSI8jWf0X6JuryjWHjhuMapX69FKZSVg", "uuid": "b4156aea-a968-4722-a4fd-1123ded04736", "serial-number": "48525687125863258471123568955554", "company": "HUAWEI", "phone-model": "P10", "system-version": "8.0.0" } result = requests.post(self.base_url1, params=payload, headers=headers) result = result.json() print(result)
def testcase_002(self): date = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()) self.path = Url().test_path() self.version = Version().test_version() # 路径 url = Url().test_url() self.base_url1 = url + '/posts/publish' obj = ({ "viewPermission": 2, "votePermission": 2, "expireTimeStamp": 0, "expireTime": 3600, "totalVoteNum": 4444, "options": [{ "option": "选项一 译文", "optionSource": "选项一 原文", "num": 0, "voteStatus": 1 }, { "option": "选项二 译文", "optionSource": "选项二 原文", "num": 0, "voteStatus": 1 }] }) obj2 = ({"lat": 12.343232, "lon": 34.3232322}) votes = json.dumps(obj) payload = { "content": "投票仅群组在成员看到", "category": "vote", "voteParams": votes, "guid": "dbceb048-6a97-47e9-bc99-d69153d28ca1" } headers = { "device": "android", "version": "4.0.0", "lang": "en", "timestamp": "1564033489234", "token": "FkUw1pOFkUw1pOBHh7xSI8jWf0X6JuryjWHjhuMapX69FKZSVgBHh7xSI8jWf0X6JuryjWHjhuMapX69FKZSVg", "uuid": "a5f10151-5685-4432-8c35-7198bc6511c9", "serial-number": "48525687125863258471123568955554", "company": "HUAWEI", "phone-model": "P10", "system-version": "8.0.0" } result = requests.post(self.base_url1, params=payload, headers=headers) result = result.json() print(result)
def __init__(self): self.version = Version().test_version() self.base_url = Url().test_url() + '/sign/in' self.list = [ 'device=android ', 'version=3.8.0', 'lang=en', 'timestamp=1493780505', 'serial-number=48525687125863258471123568955554', 'company=HUAWEI', 'phone-model=P10', 'system-version=system_version' ]
def interface_requests_payload(self, member_id, sheet_index, row, payload): # 获取EXcel路径 self.path = Url().test_path() # 路径 url = Url().test_url() self.obi = Read_ExcelData() self.base_url = self.obi.read_excel_data(sheet_index, row, 4) self.base_url1 = url + self.base_url # 获取版本 self.version = Version().test_version() payload = payload #获取token值 token = Token().test_token1(payload, member_id) # 记录接口的请求时间 start = time.time() headers = { "device": "android ", "version": self.version, "lang": "en", "timestamp": "1493780505", "token": token, "login": member_id, "serial-number": "48525687125863258471123568955554", "company": "HUAWEI", "phone-model": "P10", "system-version": "system_version" } r = requests.post(self.base_url1, params=payload, headers=headers) result = r.json() format_result = json.dumps(result, ensure_ascii=False, indent=1) print(format_result) end = time.time() # 写入excel中 str_result = str(result) self.obj = Write_ExcelData() self.obj.write_excel_data(sheet_index, row, 6, result["code"], self.path) self.obj.write_excel_data(sheet_index, row, 7, result["msg"], self.path) if len(str_result) > 32767: self.obj.write_excel_data(sheet_index, row, 8, str_result[0:32767], self.path) self.obj.write_excel_data(sheet_index, row, 9, str_result[32767:], self.path) else: self.obj.write_excel_data(sheet_index, row, 8, str_result, self.path) self.obj.write_excel_data(sheet_index, row, 10, end - start, self.path) return result
def testcase_001(self): date = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()) self.path = Url().test_path() self.version = Version().test_version() # 路径 url = Url().test_url() self.base_url1 =url + '/question/invitationanswerlist' payload = {} headers = {"device": "android", "version": "3.9.0", "lang": "en", "timestamp": "1564033489234", "token": "FkUw1pOFkUw1pOBHh7xSI8jWf0X6JuryjWHjhuMapX69FKZSVgBHh7xSI8jWf0X6JuryjWHjhuMapX69FKZSVg", "uuid": "a1018372-e5a0-4596-a232-da1a7af2061b", "serial-number": "48525687125863258471123568955554", "company": "HUAWEI", "phone-model": "P10", "system-version": "8.0.0"} result = requests.post ( self.base_url1, params=payload,headers=headers ) result = result.json () print ( result )
def testcase_002(self): sheet_index =0 row = 26 print("testcase002 用nickname登录成功:") payload = {"account":"test","password":"******"} urlpart = '/sign/in' result1 = self.r.interface_requests_data(959, urlpart, payload) # 路径 url = Url().test_url() self.base_url=url+urlpart # 获取版本 self.version = Version().test_version() headers = {"device": "android ", "version": self.version, "lang": "en", "timestamp": "1493780505", "token": "FkUw1pOFkUw1pOBHh7xSI8jWf0X6JuryjWHjhuMapX69FKZSVgBHh7xSI8jWf0X6JuryjWHjhuMapX69FKZSVg", "login": "******","serial-number":"48525687125863258471123568955554","company":"HUAWEI","phone-model":"P10","system-version":"system_version"} r = requests.post(self.base_url, params=payload, headers=headers) result = r.json() self.assertEqual(10000, result['code']) print("code返回值:10000") self.assertEqual('', result['msg']) print("msg返回值:ok")
def setUp(self): url = Url().test_url() self.base_url = url + '/posts/violation/detail' self.version = Version().test_version()
def __init__(self): #获取版本 self.version = Version().test_version() self.base_url0 = Url().test_url() + '/token'
def setUp(self): url = Url().test_url() self.base_url = url + '/search/integrate/new' self.version = Version().test_version()
def testcase_001(self): sheet_index = 1 row = 11 i = 38130 print("testcase_001发布评论:") # 调用发布接口发送一条动态,获取post_id date = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()) self.path = Url().test_path() self.version = Version().test_version() # 路径 url = Url().test_url() while i <= 38180: #从数据库取UUID i = i + 1 sql = SQL_vaffle().select_uuid(i) uuid = '%s' % SQL_SEARCH_1().search(sql) self.base_url1 = url + '/group/addmember' payload = { "guid": "856dda7c-95e6-491b-bcc1-9d48d51ef00a", "type": "add" } headers = { "device": "android", "version": "3.8.3", "lang": "en", "timestamp": "1564033489234", "token": "FkUw1pOFkUw1pOBHh7xSI8jWf0X6JuryjWHjhuMapX69FKZSVgBHh7xSI8jWf0X6JuryjWHjhuMapX69FKZSVg", "uuid": uuid, "serial-number": "48525687125863258471123568955554", "company": "HUAWEI", "phone-model": "P10", "system-version": "8.0.0" } result = requests.post(self.base_url1, params=payload, headers=headers) result = result.json() print(result) self.base_url2 = url + '/member/group/banAdd' payload = { "type": "ban", "member_uuid": uuid, "ban_day": "30", "guid": "856dda7c-95e6-491b-bcc1-9d48d51ef00a" } headers = { "device": "android", "version": "3.8.3", "lang": "en", "timestamp": "1564033489234", "token": "FkUw1pOFkUw1pOBHh7xSI8jWf0X6JuryjWHjhuMapX69FKZSVgBHh7xSI8jWf0X6JuryjWHjhuMapX69FKZSVg", "uuid": "a5f10151-5685-4432-8c35-7198bc6511c9", "serial-number": "48525687125863258471123568955554", "company": "HUAWEI", "phone-model": "P10", "system-version": "8.0.0" } result = requests.post(self.base_url2, params=payload, headers=headers) result = result.json() print(result) #global comment_id #comment_id = result["data"]["comment_id"] self.assertEqual(10000, result["code"]) print("code返回值:10000")
def setUp(self): url = Url ().test_url() self.base_url = url+'/group/notice' self.version =Version().test_version()
def __init__(self): self.version =Version().test_version() self.list = ['device=android', 'version=3.8.0', 'lang=en', 'serial-number=48525687125863258471123568955554', 'company=HUAWEI', 'phone-model=P10', 'system-version=system_version']
def setUp(self): url = Url().test_url() self.base_url = url + '/comments/publish' self.version = Version().test_version()
def setUp(self): url = Url().test_url() self.base_url = url + '/discover/recommend/hashtag' self.version = Version().test_version()
def setUp(self): url = Url().test_url() self.base_url = url + '/system/translate' self.version = Version().test_version()
def setUp(self): url = Url().test_url() self.base_url = url + '/home/limitpostad' self.version = Version().test_version()
def setUp(self): url = Url ().test_url() self.base_url = url+'/posts/lists' self.version =Version().test_version()
def setUp(self): url = Url().test_url() self.base_url = url + '/group/memberlist/search' self.version = Version().test_version()
def setUp(self): url = Url().test_url() self.base_url = url + '/newuser/float' self.version = Version().test_version()
def setUp(self): url = Url().test_url() self.base_url = url + '/member/reset_send_mail' self.version = Version().test_version()
def setUp(self): url = Url ().test_url() self.base_url = url+'/arbitrate/exam' self.version =Version().test_version()
def setUp(self): url = Url().test_url() self.base_url = url + '/home/recommend' self.version = Version().test_version()
def setUp(self): url = Url().test_url() self.base_url = url + '/system/preconfig' self.version = Version().test_version()
def setUp(self): url = Url().test_url() self.base_url = url + '/group/aggregation' self.version = Version().test_version()