コード例 #1
0
 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
コード例 #2
0
    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)
コード例 #3
0
    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)
コード例 #4
0
    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)
コード例 #5
0
    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)
コード例 #6
0
    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)
コード例 #7
0
    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)
コード例 #8
0
    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)
コード例 #9
0
    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'
        ]
コード例 #10
0
    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
コード例 #11
0
    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 )
コード例 #12
0
 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")
コード例 #13
0
 def setUp(self):
     url = Url().test_url()
     self.base_url = url + '/posts/violation/detail'
     self.version = Version().test_version()
コード例 #14
0
 def __init__(self):
     #获取版本
     self.version = Version().test_version()
     self.base_url0 = Url().test_url() + '/token'
コード例 #15
0
 def setUp(self):
     url = Url().test_url()
     self.base_url = url + '/search/integrate/new'
     self.version = Version().test_version()
コード例 #16
0
    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")
コード例 #17
0
 def setUp(self):
     url = Url ().test_url()
     self.base_url = url+'/group/notice'
     self.version =Version().test_version()
コード例 #18
0
 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']
コード例 #19
0
 def setUp(self):
     url = Url().test_url()
     self.base_url = url + '/comments/publish'
     self.version = Version().test_version()
コード例 #20
0
 def setUp(self):
     url = Url().test_url()
     self.base_url = url + '/discover/recommend/hashtag'
     self.version = Version().test_version()
コード例 #21
0
 def setUp(self):
     url = Url().test_url()
     self.base_url = url + '/system/translate'
     self.version = Version().test_version()
コード例 #22
0
 def setUp(self):
     url = Url().test_url()
     self.base_url = url + '/home/limitpostad'
     self.version = Version().test_version()
コード例 #23
0
 def setUp(self):
     url = Url ().test_url()
     self.base_url = url+'/posts/lists'
     self.version =Version().test_version()
コード例 #24
0
 def setUp(self):
     url = Url().test_url()
     self.base_url = url + '/group/memberlist/search'
     self.version = Version().test_version()
コード例 #25
0
 def setUp(self):
     url = Url().test_url()
     self.base_url = url + '/newuser/float'
     self.version = Version().test_version()
コード例 #26
0
 def setUp(self):
     url = Url().test_url()
     self.base_url = url + '/member/reset_send_mail'
     self.version = Version().test_version()
コード例 #27
0
 def setUp(self):
     url = Url ().test_url()
     self.base_url = url+'/arbitrate/exam'
     self.version =Version().test_version()
コード例 #28
0
 def setUp(self):
     url = Url().test_url()
     self.base_url = url + '/home/recommend'
     self.version = Version().test_version()
コード例 #29
0
 def setUp(self):
     url = Url().test_url()
     self.base_url = url + '/system/preconfig'
     self.version = Version().test_version()
コード例 #30
0
 def setUp(self):
     url = Url().test_url()
     self.base_url = url + '/group/aggregation'
     self.version = Version().test_version()