Commit 84829639 by DuJunLi

优化代码

parent 54902544
...@@ -38,45 +38,46 @@ public class TestSaveShareScheduleConfig extends BaseTestImpl { ...@@ -38,45 +38,46 @@ public class TestSaveShareScheduleConfig extends BaseTestImpl {
public void testSaveShareScheduleConfig() { public void testSaveShareScheduleConfig() {
//点击分享获取课表配置信息:默认配置 //点击分享获取课表配置信息:默认配置
groupScheduleTools.getShareScheduleConfig(); groupScheduleTools.getShareScheduleConfig();
JSONObject configInfo= XMJSONPath.getJSONObjectByReadPath(dataApi.getApi_response(),"$.result"); JSONObject configInfo = new JSONObject();
configInfo = XMJSONPath.getJSONObjectByReadPath(dataApi.getApi_response(), "$.result");
//什么都不操作,走默认配置,下载课表 //什么都不操作,走默认配置,下载课表
groupScheduleTools.saveShareScheduleConfig(configInfo); groupScheduleTools.saveShareScheduleConfig(configInfo);
//修改配置,然后操作下载课表check //修改配置,然后操作下载课表check
JSONObject body = new JSONObject(); JSONObject body = new JSONObject();
String shareTitle="阿杜测试团课课表分享"; String shareTitle = "阿杜测试团课课表分享";
body.put("operatorId", xmAppApi.getLoginInfo().getAdminId()); body.put("operatorId", xmAppApi.getLoginInfo().getAdminId());
body.put("studioId", xmAppApi.getLoginInfo().getStudioId()); body.put("studioId", xmAppApi.getLoginInfo().getStudioId());
body.put("brandId", xmAppApi.getLoginInfo().getBrandId()); body.put("brandId", xmAppApi.getLoginInfo().getBrandId());
body.put("shareTitle",shareTitle); body.put("shareTitle", shareTitle);
body.put("showCustomBg", false); body.put("showCustomBg", false);
body.put("showCustomQrCode", false); body.put("showCustomQrCode", false);
List<String> showContent=new ArrayList<>(); List<String> showContent = new ArrayList<>();
showContent.add("COACH_NICK_NAME"); showContent.add("COACH_NICK_NAME");
showContent.add("AREA_NAME"); showContent.add("AREA_NAME");
body.put("showContent", showContent); body.put("showContent", showContent);
//修改后再调用获取配置接口check是否同步修改 //修改后再调用获取配置接口check是否同步修改
xmAppApi.doRequest(RequestType.JSON, params, body.toString(), headers); xmAppApi.doRequest(RequestType.JSON, params, body.toString(), headers);
Assert.assertTrue(Boolean.valueOf(XMJSONPath.readPath(xmAppApi.getApi_response(),"$.success"))==true,"调用接口返回结果:"+XMJSONPath.readPath(xmAppApi.getApi_response(),"$.message")); Assert.assertTrue(Boolean.valueOf(XMJSONPath.readPath(xmAppApi.getApi_response(), "$.success")) == true, "调用接口返回结果:" + XMJSONPath.readPath(xmAppApi.getApi_response(), "$.message"));
//查看配置信息 //查看配置信息
groupScheduleTools.getShareScheduleConfig(); groupScheduleTools.getShareScheduleConfig();
Assert.assertTrue(shareTitle.equals(XMJSONPath.readPath(dataApi.getApi_response(),"$.result.shareTitle"))); Assert.assertTrue(shareTitle.equals(XMJSONPath.readPath(dataApi.getApi_response(), "$.result.shareTitle")));
System.out.println("***"+XMJSONPath.getJSONArrayByReadPath(dataApi.getApi_response(),"$.result.showContent").size()); System.out.println("***" + XMJSONPath.getJSONArrayByReadPath(dataApi.getApi_response(), "$.result.showContent").size());
System.out.println("***"+!XMJSONPath.getJSONArrayByReadPath(dataApi.getApi_response(),"$.result.showContent").contains("AREA_NAME")); System.out.println("***" + !XMJSONPath.getJSONArrayByReadPath(dataApi.getApi_response(), "$.result.showContent").contains("AREA_NAME"));
Assert.assertTrue(XMJSONPath.getJSONArrayByReadPath(dataApi.getApi_response(),"$.result.showContent").size()==2 && !XMJSONPath.getJSONArrayByReadPath(dataApi.getApi_response(),"$.result.showContent").contains("COURSE_COLOR")); Assert.assertTrue(XMJSONPath.getJSONArrayByReadPath(dataApi.getApi_response(), "$.result.showContent").size() == 2 && !XMJSONPath.getJSONArrayByReadPath(dataApi.getApi_response(), "$.result.showContent").contains("COURSE_COLOR"));
//还原配置 //还原配置
configInfo.put("shareTitle", "课程表");
showContent.add("COURSE_COLOR");
configInfo.put("showContent", showContent);
groupScheduleTools.saveShareScheduleConfig(configInfo); groupScheduleTools.saveShareScheduleConfig(configInfo);
//还原配置后获取配置信息 //还原配置后获取配置信息
groupScheduleTools.getShareScheduleConfig(); groupScheduleTools.getShareScheduleConfig();
JSONObject configInfoA= XMJSONPath.getJSONObjectByReadPath(dataApi.getApi_response(),"$.result"); JSONObject configInfoA = XMJSONPath.getJSONObjectByReadPath(dataApi.getApi_response(), "$.result");
//check configInfoA和configInfo是否相等 //check configInfoA和configInfo是否相等
Assert.assertTrue(configInfoA.getString("shareTitle").equals(configInfo.getString("shareTitle")),"还原配置后,课表名称没恢复"); Assert.assertTrue(configInfoA.getString("shareTitle").equals(configInfo.getString("shareTitle")), "还原配置后,课表名称没恢复");
Assert.assertTrue(configInfoA.getJSONArray("showContent").containsAll(configInfo.getJSONArray("showContent")),"还原配置后,课表内容展示没恢复默认"); Assert.assertTrue(configInfoA.getJSONArray("showContent").containsAll(configInfo.getJSONArray("showContent")), "还原配置后,课表内容展示没恢复默认");
} }
......
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