Commit 653a7c78 authored by 郭姣's avatar 郭姣

成功案例,上传链接接口用例修改

parent e5882849
package com.kjj.cases.assistant; package com.kjj.cases.assistant.homePage;
import static com.kjj.config.BasicConfig.*; import static com.kjj.config.BasicConfig.*;
......
package com.kjj.cases.assistant; package com.kjj.cases.assistant.homePage;
import static com.kjj.config.BasicConfig.*; import static com.kjj.config.BasicConfig.*;
import com.kjj.cases.admin.Authorization; import com.kjj.cases.admin.Authorization;
...@@ -12,7 +12,7 @@ import java.io.IOException; ...@@ -12,7 +12,7 @@ import java.io.IOException;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
public class homePage implements Authorization { public class HomePage implements Authorization {
public int firstTagId; //获取种草素材标签ID public int firstTagId; //获取种草素材标签ID
public String contentId; //获取素材文章id public String contentId; //获取素材文章id
public String tagId; //获取发圈素材标签ID public String tagId; //获取发圈素材标签ID
...@@ -20,9 +20,12 @@ public class homePage implements Authorization { ...@@ -20,9 +20,12 @@ public class homePage implements Authorization {
public int hotTagId; //获取热榜标签ID public int hotTagId; //获取热榜标签ID
public int posterTagId; //获取海报标签ID public int posterTagId; //获取海报标签ID
public String posterContentId; //获取海报的的contentId public String posterContentId; //获取海报的的contentId
public int caseId; //获取成功案例id
@BeforeClass @BeforeClass
public void setUp() { public void setUp() {
//管理后台登录
BaseUtils.ssoLogin();
// 创建用户 并传到network里 // 创建用户 并传到network里
AGENT_TKU = BaseUtils.createTku(); AGENT_TKU = BaseUtils.createTku();
network.agentCookies.put("tku", AGENT_TKU); network.agentCookies.put("tku", AGENT_TKU);
...@@ -222,4 +225,102 @@ public class homePage implements Authorization { ...@@ -222,4 +225,102 @@ public class homePage implements Authorization {
Object obj = response.jsonPath().getJsonObject("data.list"); Object obj = response.jsonPath().getJsonObject("data.list");
Assert.assertNotNull(obj, network.message(params,HOME_getContentList,"获取首页视频列表失败",response.body().asString())); Assert.assertNotNull(obj, network.message(params,HOME_getContentList,"获取首页视频列表失败",response.body().asString()));
} }
//获取首页公司专区
@Test(description = "首页_公司专区列表",priority = 15)
public void 首页_公司专区列表(){
Response response = network.getResponse(HOME_getExclusiveArea);
Object data = response.jsonPath().getJsonObject("data");
Assert.assertNotNull(data,network.message(HOME_getExclusiveArea,"获取公司专区列表失败",response.body().asString()));
}
//管理后台新增成功案例
@Test(description = "管理后台_新增成功案例",priority = 15)
public void 新增成功案例(){
//根据内容ID匹配内容标题
Map<String,Object> params = new HashMap<>();
params.put("itemId",9398);
Response response = network.getResponse(params,MANAGER_getPushContent);
String desc = response.jsonPath().getString("desc");
boolean success = response.jsonPath().getBoolean("success");
Assert.assertEquals(desc,"OK", network.message(params,MANAGER_getPushContent,"内容ID匹配内容标题失败",response.body().asString()));
Assert.assertTrue(success, network.message(params,MANAGER_getPushContent,"内容ID匹配内容标题请求失败",response.body().asString()));
//新增成功案例
Map<String,Object> addParams = new HashMap<>();
addParams.put("beltImg","//yun.dui88.com/kjy/image/20210727/1627369041241.jpeg");
addParams.put("blockImg","//yun.dui88.com/kjy/image/20210727/1627369049937.jpeg");
addParams.put("contentId",9398);
addParams.put("layerImg","//yun.dui88.com/kjy/image/20210727/1627369034207.jpg");
addParams.put("thumbnailImg","//yun.dui88.com/kjy/image/20210727/1627369057234.jpeg");
long timeOpening = System.currentTimeMillis();
addParams.put("timeOpening",timeOpening);
Response addRes = network.postResponse(addParams,MANAGER_addOrUpdateCases);
String addDesc = addRes.jsonPath().getString("desc");
boolean addSuccess = addRes.jsonPath().getBoolean("success");
Assert.assertEquals(addDesc,"OK", network.message(addParams,MANAGER_addOrUpdateCases,"新增成功案例失败",addRes.body().asString()));
Assert.assertTrue(addSuccess, network.message(addParams,MANAGER_addOrUpdateCases,"新增成功案例失败",addRes.body().asString()));
}
@Test(description = "管理后台_获取成功案例列表",priority = 16)
public void 获取成功案例列表(){
Response response = network.getResponse(MANAGER_caseList);
Object list = response.jsonPath().getJsonObject("data.list");
caseId = response.jsonPath().getInt("data.list.get(0).id");
Assert.assertNotNull(list,network.message(MANAGER_caseList,"获取成功案例列表失败",response.body().asString()));
}
@Test(description = "管理后台_获取案例详情",priority = 17)
public void 获取案例详情(){
Map<String,Object> params = new HashMap<>();
params.put("id",caseId);
Response response = network.getResponse(params,MANAGER_successCaseDetail);
Object data = response.jsonPath().getJsonObject("data");
Assert.assertNotNull(data,network.message(params,MANAGER_successCaseDetail,"获取案例详情失败",response.body().asString()));
}
@Test(description = "管理后台_编辑案例",priority = 18)
public void 编辑案例(){
//编辑成功案例
Map<String,Object> params = new HashMap<>();
params.put("beltImg","//yun.dui88.com/kjy/image/20210727/1627369041241.jpeg");
params.put("blockImg","//yun.dui88.com/kjy/image/20210727/1627369049937.jpeg");
params.put("contentId",9398);
params.put("id",caseId);
params.put("layerImg","//yun.dui88.com/kjy/image/20210727/1627369034207.jpg");
params.put("thumbnailImg","//yun.dui88.com/kjy/image/20210727/1627369057234.jpeg");
long timeOpening = System.currentTimeMillis();
params.put("timeOpening",timeOpening);
Response addRes = network.postResponse(params,MANAGER_addOrUpdateCases);
String addDesc = addRes.jsonPath().getString("desc");
boolean addSuccess = addRes.jsonPath().getBoolean("success");
Assert.assertEquals(addDesc,"OK", network.message(params,MANAGER_addOrUpdateCases,"编辑成功案例失败",addRes.body().asString()));
Assert.assertTrue(addSuccess, network.message(params,MANAGER_addOrUpdateCases,"编辑成功案例失败",addRes.body().asString()));
}
@Test(description = "管理后台_上架/下架成功案例",priority = 19)
public void 上架成功案例(){
//上架成功案例 status = 2
Map<String,Object> params = new HashMap<>();
params.put("id",caseId);
params.put("status",2);
Response response = network.postResponse(params,MANAGER_updateStatus);
boolean data = response.jsonPath().getBoolean("data");
boolean success = response.jsonPath().getBoolean("success");
Assert.assertTrue(data,network.message(params,MANAGER_updateStatus,"上架成功案例失败",response.body().asString()));
Assert.assertTrue(success,network.message(params,MANAGER_updateStatus,"上架成功案例失败",response.body().asString()));
//下架成功案例 status = 1
Map<String,Object> updateParams = new HashMap<>();
updateParams.put("id",caseId);
updateParams.put("status",1);
Response updateRes = network.postResponse(params,MANAGER_updateStatus);
boolean updateData = updateRes.jsonPath().getBoolean("data");
boolean updateSuccess = updateRes.jsonPath().getBoolean("success");
Assert.assertTrue(updateData,network.message(params,MANAGER_updateStatus,"下架成功案例失败",updateRes.body().asString()));
Assert.assertTrue(updateSuccess,network.message(params,MANAGER_updateStatus,"下架成功案例失败",updateRes.body().asString()));
}
} }
package com.kjj.cases.assistant; package com.kjj.cases.assistant.homePage;
import static com.kjj.config.BasicConfig.*; import static com.kjj.config.BasicConfig.*;
......
package com.kjj.cases.basics; package com.kjj.cases.assistant.homePage;
import static com.kjj.config.BasicConfig.*; import static com.kjj.config.BasicConfig.*;
import com.kjj.utils.NetworkUtils; import com.kjj.utils.NetworkUtils;
...@@ -27,7 +27,44 @@ public class Upload { ...@@ -27,7 +27,44 @@ public class Upload {
// Assert.assertTrue(true, network.message(ISVIPSUBSCRIBE,"会员判断错误",response.body().asString())); // Assert.assertTrue(true, network.message(ISVIPSUBSCRIBE,"会员判断错误",response.body().asString()));
// } // }
@Test(description = "上传_文章链接",priority = 2) @Test(description = "获取首页上传链接配置",priority = 1)
public void 上传链接配置(){
Map<String,Object> params = new HashMap<>();
params.put("type",1);
Response response = network.getResponse(params,Daily_getHomeConf);
Object resourceLocatorName = response.jsonPath().getJsonObject("data.get(4).resourceLocatorName");
Assert.assertEquals(resourceLocatorName,"上传链接", network.message(params,Daily_getHomeConf,"获取上传链接配置失败",response.body().asString()));
}
@Test(description = "爬虫支持的域名",priority = 2)
public void 爬虫支持的域名(){
Response response = network.getResponse(UPLOAD_supportDomain);
Object data = response.jsonPath().getJsonObject("data");
Assert.assertNotNull(data, network.message(UPLOAD_supportDomain,"获取域名列表失败",response.body().asString()));
}
@Test(description = "判断是否第一次访问",priority = 3)
public void 判断是否第一次访问(){
Map<String,Object> params = new HashMap<>();
params.put("type",8);
Response response = network.getResponse(params,UPLOAD_sellerFirstVisit);
boolean success = response.jsonPath().getBoolean("success");
Assert.assertTrue(success, network.message(params,UPLOAD_sellerFirstVisit,"判断是否第一次访问失败",response.body().asString()));
}
@Test(description = "上传_查看tips",priority = 4)
public void 查看tips(){
Map<String,Object> params = new HashMap<>();
params.put("page","upload_link");
long timestamp = System.currentTimeMillis();
params.put("timestamp",timestamp);
Response response = network.getResponse(params,GREETING_getTipsByPage);
boolean isShowTips = response.jsonPath().getBoolean("data.isShowTips");
boolean success = response.jsonPath().getBoolean("success");
Assert.assertTrue(isShowTips, network.message(params,GREETING_getTipsByPage,"tips展示成功",response.body().asString()));
Assert.assertTrue(success,network.message(params,GREETING_getTipsByPage,"查看tips请求失败",response.body().asString()));
}
@Test(description = "上传_文章链接",priority = 5)
public void 上传_文章链接() throws IOException { public void 上传_文章链接() throws IOException {
//待上传的文章链接 //待上传的文章链接
String articleLink = "https://mp.weixin.qq.com/s/j4qnDM98d2ZPW35ozFra8w"; String articleLink = "https://mp.weixin.qq.com/s/j4qnDM98d2ZPW35ozFra8w";
...@@ -51,7 +88,7 @@ public class Upload { ...@@ -51,7 +88,7 @@ public class Upload {
Assert.assertEquals(contentType,"article", network.message(taskParams, UPLOAD_TASKSTATUS,"上传文章链接-查询调用失败",response.body().asString())); Assert.assertEquals(contentType,"article", network.message(taskParams, UPLOAD_TASKSTATUS,"上传文章链接-查询调用失败",response.body().asString()));
} }
@Test(description="上传_视频链接",priority = 3) @Test(description="上传_视频链接",priority = 6)
public void 上传_视频链接() throws IOException{ public void 上传_视频链接() throws IOException{
//待上传的视频链接 //待上传的视频链接
String videoLink = "https://v.douyin.com/oEahcd/ 复制此链接,打开【抖音短视频】,直接观看视频!"; String videoLink = "https://v.douyin.com/oEahcd/ 复制此链接,打开【抖音短视频】,直接观看视频!";
...@@ -75,7 +112,7 @@ public class Upload { ...@@ -75,7 +112,7 @@ public class Upload {
Assert.assertEquals(responseTaskId,taskId,network.message(taskParams, UPLOAD_TASKSTATUS,"上传视频链接-查询调用失败",response.body().asString())); Assert.assertEquals(responseTaskId,taskId,network.message(taskParams, UPLOAD_TASKSTATUS,"上传视频链接-查询调用失败",response.body().asString()));
} }
@Test(description = "上传_其他链接",priority = 4) @Test(description = "上传_其他链接",priority = 7)
public void 上传_其他链接() throws IOException { public void 上传_其他链接() throws IOException {
//待上传的其他链接 //待上传的其他链接
String network_link = "https://tieba.baidu.com/p/6688007444"; String network_link = "https://tieba.baidu.com/p/6688007444";
...@@ -114,7 +151,7 @@ public class Upload { ...@@ -114,7 +151,7 @@ public class Upload {
Assert.assertEquals(shareLink, network_link,network.message(updateParams, UPLOAD_UPDATEANDSHARE,"传其他链接-上传和分享调用失败",response.body().asString())); Assert.assertEquals(shareLink, network_link,network.message(updateParams, UPLOAD_UPDATEANDSHARE,"传其他链接-上传和分享调用失败",response.body().asString()));
} }
@Test(description = "上传_本地视频",priority = 5) @Test(description = "上传_本地视频",priority = 8)
public void 上传_本地视频() throws IOException { public void 上传_本地视频() throws IOException {
//1.上传视频到oss //1.上传视频到oss
String videoFile = "src/test/java/com/kjj/resource/uploadCase.mp4"; String videoFile = "src/test/java/com/kjj/resource/uploadCase.mp4";
...@@ -133,7 +170,7 @@ public class Upload { ...@@ -133,7 +170,7 @@ public class Upload {
// Assert.assertNotNull(contentId,network.message(params, UPLOAD_SELLERUPLOADVEDIO,"上传本地视频-上传第2步失败")); // Assert.assertNotNull(contentId,network.message(params, UPLOAD_SELLERUPLOADVEDIO,"上传本地视频-上传第2步失败"));
} }
@Test(description="大家都在转_榜单列表",priority = 6) @Test(description="大家都在转_榜单列表",priority = 9)
public void 大家都在转_榜单列表() throws IOException{ public void 大家都在转_榜单列表() throws IOException{
//获取文章的榜单 //获取文章的榜单
Response response = network.getResponse(UPLOAD_HOT); Response response = network.getResponse(UPLOAD_HOT);
...@@ -151,7 +188,7 @@ public class Upload { ...@@ -151,7 +188,7 @@ public class Upload {
} }
//我的上传: //我的上传:
@Test(description="我的上传",priority = 7) @Test(description="我的上传",priority = 10)
public void 我的上传() throws IOException{ public void 我的上传() throws IOException{
Map<String, Object> params = new HashMap<String, Object>(); Map<String, Object> params = new HashMap<String, Object>();
params.put("pageIndex",1); params.put("pageIndex",1);
......
...@@ -691,8 +691,8 @@ public class BasicConfig { ...@@ -691,8 +691,8 @@ public class BasicConfig {
public static final String UPLOAD_VIDEOHOT = HOST + "/kjy/mp/seller/import/video/hot"; public static final String UPLOAD_VIDEOHOT = HOST + "/kjy/mp/seller/import/video/hot";
public static final String UPLOAD_LIST = HOST + "/kjy/mp/seller/import/list"; public static final String UPLOAD_LIST = HOST + "/kjy/mp/seller/import/list";
public static final String UPLOAD_UNBIND = HOST + "/kjy/mp/seller/import/unbind"; public static final String UPLOAD_UNBIND = HOST + "/kjy/mp/seller/import/unbind";
public static final String UPLOAD_supportDomain = HOST + "/kjy/mp/supportDomain";
public static final String UPLOAD_sellerFirstVisit = HOST + "/kjy/mp/newFunction/sellerFirstVisit";
// *************** 新手任务 *************** // *************** 新手任务 ***************
public static final String NOVICE_LIST = HOST + "/kjy/mp/seller/novice/list"; public static final String NOVICE_LIST = HOST + "/kjy/mp/seller/novice/list";
...@@ -764,7 +764,7 @@ public class BasicConfig { ...@@ -764,7 +764,7 @@ public class BasicConfig {
public static final String HOME_getTags4Poster = HOST + "/kjy/mp/posterTemplate/getTags4Poster"; public static final String HOME_getTags4Poster = HOST + "/kjy/mp/posterTemplate/getTags4Poster";
public static final String HOME_getPosterTemplateList = HOST + "/kjy/mp/posterTemplate/getPosterTemplateList"; public static final String HOME_getPosterTemplateList = HOST + "/kjy/mp/posterTemplate/getPosterTemplateList";
public static final String HOME_findPosterById = HOST + "/kjy/mp/posterTemplate/findPosterById"; public static final String HOME_findPosterById = HOST + "/kjy/mp/posterTemplate/findPosterById";
public static final String HOME_getExclusiveArea = HOST + "/kjy/mp/classify/getExclusiveArea";
// ************** 设置中心 *************** // ************** 设置中心 ***************
public static final String SELLERCONFIG_EDITCONFIG = HOST + "/kjy/mp/sellerConfig/editConfig"; public static final String SELLERCONFIG_EDITCONFIG = HOST + "/kjy/mp/sellerConfig/editConfig";
...@@ -853,4 +853,11 @@ public class BasicConfig { ...@@ -853,4 +853,11 @@ public class BasicConfig {
public static final String MANAGER_SELLERTEAM_REMOVEMEMBER = MANAGER_HOST + "/kjy/manager/sellerTeam/removeMember"; public static final String MANAGER_SELLERTEAM_REMOVEMEMBER = MANAGER_HOST + "/kjy/manager/sellerTeam/removeMember";
public static final String MANAGER_SELLERID_ENCODE = MANAGER_HOST + "/kjy/manager/testUser/encode"; public static final String MANAGER_SELLERID_ENCODE = MANAGER_HOST + "/kjy/manager/testUser/encode";
public static final String MANAGER_TKU_DECODE = MANAGER_HOST + "/kjy/manager/testUser/decryptTku"; public static final String MANAGER_TKU_DECODE = MANAGER_HOST + "/kjy/manager/testUser/decryptTku";
public static final String MANAGER_getPushContent = MANAGER_HOST + "/kjy/manager/pushManager/getPushContent";
public static final String MANAGER_addOrUpdateCases = MANAGER_HOST + "/kjy/manager/successCases/addOrUpdateCases";
public static final String MANAGER_caseList = MANAGER_HOST + "/kjy/manager/successCases/caseList";
public static final String MANAGER_successCaseDetail = MANAGER_HOST + "/kjy/manager/successCases/successCaseDetail";
public static final String MANAGER_updateStatus = MANAGER_HOST + "/kjy/manager/successCases/updateStatus";
public static final String MANAGER_mainPush = MANAGER_HOST + "/kjy/manager/successCases/mainPush";
public static final String MANAGER_addExclusiveArea = MANAGER_HOST + "/kjy/manager/exclusiveArea/add";
} }
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
</test> </test>
<test preserve-order="true" name = "首页"> <test preserve-order="true" name = "首页">
<classes> <classes>
<class name="com.kjj.cases.assistant.homePage"/> <class name="com.kjj.cases.assistant.homePage.HomePage"/>
</classes> </classes>
</test> </test>
<test preserve-order="true" name="我的名片"> <test preserve-order="true" name="我的名片">
...@@ -24,12 +24,17 @@ ...@@ -24,12 +24,17 @@
</test> </test>
<test preserve-order="true" name = "种草素材"> <test preserve-order="true" name = "种草素材">
<classes> <classes>
<class name="com.kjj.cases.assistant.RecommendMaterial"/> <class name="com.kjj.cases.assistant.homePage.RecommendMaterial"/>
</classes> </classes>
</test> </test>
<test preserve-order="true" name = "今日早报"> <test preserve-order="true" name = "今日早报">
<classes> <classes>
<class name="com.kjj.cases.assistant.DailyPaper"/> <class name="com.kjj.cases.assistant.homePage.DailyPaper"/>
</classes>
</test>
<test preserve-order="true" name = "上传链接">
<classes>
<class name="com.kjj.cases.assistant.homePage.Upload"/>
</classes> </classes>
</test> </test>
<test preserve-order="true" name = "谁看过我_团队看板"> <test preserve-order="true" name = "谁看过我_团队看板">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment