예제 #1
0
 def test008_get_material_filekey(self):
     '''获取素材filekey'''
     global access_token
     global base_url
     global caseName
     global filekey
     global uploadToken
     caseName = "8 获取素材filekey"
     log.info("--------------------" + caseName + "------------------开始测试")
     headers = {
         'Accept': 'application/json',
         'Authorization': 'Bearer  ' + access_token
     }
     log.info("headers--------------------" + str(headers))
     parameters = "/api/v2/op/up/token?fileName=dududu.mp4"
     asserts = [
         '"success":true,', '"filekey":"', '"uploadToken":"',
         '"accessURL":"'
     ]
     url = base_url + parameters
     response = TestMethod.getMethod(self, url, headers)
     log.info(response.text)
     # "filekey":"3cdd8157-093e-41fd-8e13-310a82eea511.mp4",
     filekey = regSearchString(response.text, '"filekey":"(.+?)",', 11, -2)
     log.info("正则--获取 filekey:  " + filekey)
     # "uploadToken":"6IRM4w7Yyl4RfC7l2gPhTd7NbHjD00i3Z4_1
     uploadToken = regSearchString(response.text, '"uploadToken":"(.+?)",',
                                   15, -2)
     log.info("正则--获取 uploadToken:  " + uploadToken)
     self.assertTrue(assertsResponse(asserts, response.text), "断言失败")
     log.info("--------------------" + caseName + "------------------测试完毕")
     time.sleep(1)
예제 #2
0
 def test003_get_filekey_uploadToken(self):
     '''获取filekey和uploadToken和accessURL'''
     global access_token
     global base_url
     global caseName
     global filekey
     global uploadToken
     global accessURL
     caseName = "3 获取filekey和uploadToken和accessURL"
     log.info("--------------------" + caseName + "------------------开始测试")
     headers = {'Accept': 'application/json', 'Authorization': 'Bearer  ' + access_token}
     log.info("headers--------------------" + str(headers))
     parameters = "/api/v2/op/up/token?fileName=熊猫公交图片.jpg"
     asserts = ["\"success\":true",'"filekey":"','"uploadToken":"','"accessURL":"']
     url = base_url + parameters
     response = TestMethod.getMethod(self, url,  headers)
     # "filekey":"3cdd8157-093e-41fd-8e13-310a82eea511.mp4",
     filekey = regSearchString(response.text, '"filekey":"(.+?)",', 11, -2)
     log.info("正则--获取filekey:  " + filekey)
     # "uploadToken":"6IRM4w7Yyl4RfC7l2gPhTd7NbHjD00i3Z4_1wKjT:vOmD4Af-
     uploadToken = regSearchString(response.text, '"uploadToken":"(.+?)",', 15, -2)
     log.info("正则--获取uploadToken:  " + uploadToken)
     # "accessURL":"https://media.quixmart.com/03a4b820-7c12-4b18-b96e-7b3c7897f533.jpg"
     accessURL = regSearchString(response.text, '"accessURL":"(.+?)"},', 13, -3)
     log.info("正则--获取accessURL:  " + accessURL)
     log.info(response.text)
     self.assertTrue(assertsResponse(asserts, response.text), "断言失败")
     log.info("--------------------" + caseName + "------------------测试完毕")
     time.sleep(1)
예제 #3
0
 def test003_add_new_ads_plan(self):
     '''新增投放计划'''
     global access_token
     global base_url
     global caseName
     global plan_id
     caseName = "3 新增投放计划"
     log.info("--------------------" + caseName + "------------------开始测试")
     headers = {
         'Accept': 'application/json',
         'Accept-Encoding': 'gzip, deflate, br',
         'Content-Type': 'application/json; charset=utf-8',
         'Authorization': 'Bearer  ' + access_token
     }
     log.info("headers--------------------" + str(headers))
     parameters = "/api/v2/ads-op/v3/plan"
     asserts = ['"success":true,', '"reason":"Created Success.",']
     url = base_url + parameters
     bodyData = {
         "name": "test00001",
         "busIds": [15],
         "startTime": 1625147576097,
         "endTime": 1625233976097
     }
     response = TestMethod.postMethod(self, url, bodyData, headers)
     # {"success":true,"reason":"Delete Success","id":43}
     plan_id = regSearchString(response.text, '"id":(.+?)}', 5, -1)
     log.info("正则--获取 plan_id:  " + plan_id)
     log.info(response.text)
     self.assertTrue(assertsResponse(asserts, response.text), "断言失败")
     log.info("--------------------" + caseName + "------------------测试完毕")
     time.sleep(10)
예제 #4
0
 def test001_auth_signin(self):
     '''熊猫智行广告平台登陆接口'''
     global access_token
     global caseName
     caseName = "1 熊猫智行广告平台登陆接口"
     log.info("--------------------" + caseName + "------------------开始测试")
     headers = ''
     log.info("headers--------------------" + str(headers))
     parameters = "/api/auth/signin?username=13889813735&password=Admin123456789"
     bodyData = ""
     url = "https://test-sso.deepblueai.com" + parameters
     response = TestMethod.postMethod(self, url, bodyData,  headers)
     # {"access_token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE1NjI0MDE2MzMsIn
     access_token = regSearchString(response.text, '"access_token":"(.+?)",', 16, -2)
     log.info("正则--获取运营平台access_token150:  " + access_token)
     log.info("--------------------" + caseName + "------------------测试完毕")
     log.info(response.text)
     time.sleep(1)
예제 #5
0
 def test005_get_modules_name(self):
     '''获取所有模块名称获取model_id'''
     global access_token
     global base_url
     global caseName
     global accessURL
     global model_id
     caseName = "5 获取所有模块名称获取model_id"
     log.info("--------------------" + caseName + "------------------开始测试")
     headers = {'Accept': 'application/json', 'Authorization': 'Bearer  ' + access_token}
     log.info("headers--------------------" + str(headers))
     parameters = "/api/v2/ads-op/module-video-summary?pageNum=1&pageSize=10"
     asserts = ["\"success\":true",'"name":"modelTest00001",','"remark":"model_discription_modelTest00001"',accessURL]
     url = base_url + parameters
     response = TestMethod.getMethod(self, url,  headers)
     # "id":222,"name":"modelTest00001"
     model_id = regSearchString(response.text, '"id":(.+?),"name":"modelTest00001"', 5, -24)
     log.info("正则--获取 model_id:  " + model_id)
     log.info(response.text)
     self.assertTrue(assertsResponse(asserts, response.text),"断言失败")
     log.info("--------------------" + caseName + "------------------测试完毕")
     time.sleep(1)
예제 #6
0
 def test011_check_video_in_modules(self):
     '''查询模块里面的视频:验证是否成功上传视频'''
     global access_token
     global base_url
     global caseName
     global model_id
     global accessURL1
     global video_id
     caseName = "11 查询模块里面的视频:验证是否成功上传视频"
     log.info("--------------------" + caseName + "------------------开始测试")
     headers = {'Accept': 'application/json', 'Authorization': 'Bearer  ' + access_token}
     log.info("headers--------------------" + str(headers))
     parameters = "/api/v2/ads-op/module-video-detail?pageNum=1&pageSize=10&moduleId={model_id}".format(model_id=model_id)
     asserts = ["\"success\":true",'"name":"test_video_00001",','"videoFormat":"mp4",',accessURL1]
     url = base_url + parameters
     response = TestMethod.getMethod(self, url,  headers)
     # "id":395,"name":"test_video_00001"
     video_id = regSearchString(response.text, '"id":(.+?),"name":"test_video_00001"', 5, -26)
     log.info("正则--获取 video_id:  " + video_id)
     log.info(response.text)
     self.assertTrue(assertsResponse(asserts, response.text),"断言失败")
     log.info("--------------------" + caseName + "------------------测试完毕")
     time.sleep(1)
예제 #7
0
 def test009_upload_material(self):
     '''上传素材'''
     global access_token
     global base_url
     global caseName
     global filekey
     global material_id
     caseName = "9 上传素材"
     log.info("--------------------" + caseName + "------------------开始测试")
     headers = {
         'Accept': 'application/json',
         'Accept-Encoding': 'gzip, deflate, br',
         'Content-Type': 'application/json; charset=utf-8',
         'Authorization': 'Bearer  ' + access_token
     }
     log.info("headers--------------------" + str(headers))
     parameters = "/api/v2/ads-op/v3/material"
     asserts = ['"name":"create_materials_test00001"']
     url = base_url + parameters
     bodyData = {
         "materialName":
         "create_materials_test00001",
         "positionId":
         7,
         "imageUrl":
         "",
         "sexTags": [{
             "tagId": "MALE",
             "tagName": "男"
         }, {
             "tagId": "FEMALE",
             "tagName": "女"
         }],
         "ageTags": [{
             "tagId": "BABY",
             "tagName": "幼年"
         }, {
             "tagId": "YOUNG",
             "tagName": "少年"
         }, {
             "tagId": "MATURE",
             "tagName": "青年"
         }, {
             "tagId": "MIDLIFE",
             "tagName": "中年"
         }, {
             "tagId": "OLD",
             "tagName": "老年"
         }],
         "materialUrl":
         "https://media.quixmart.com/{filekey}".format(filekey=filekey),
         "materialPreview":
         "https://media.quixmart.com/{filekey}".format(filekey=filekey),
         "formatCode":
         "mp4",
         "positionName":
         "熊猫公交19寸广告屏"
     }
     response = TestMethod.postMethod(self, url, bodyData, headers)
     log.info(response.text)
     # {"id":63,"name":"create_materials_test00001"}
     material_id = regSearchString(response.text, '"id":(.+?),', 5, -1)
     log.info("正则--获取 material_id:  " + material_id)
     self.assertTrue(assertsResponse(asserts, response.text), "断言失败")
     log.info("--------------------" + caseName + "------------------测试完毕")
     time.sleep(10)