Commit 1b9741b2 authored by 张艳玲's avatar 张艳玲

update

parent cb6e0544
package com.kjj.cases.live;
import com.kjj.config.BasicConfig;
import com.kjj.constants.LiveConstants;
import io.restassured.response.Response;
import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class User implements AdminAuthorization{
public String shareSign;
@BeforeClass
public void setUp() {
visitorAuth();
agentAuth();
}
//代理人分享直播链接
@Test(description = "分享直播间", priority = 1)
public void 分享直播间() {
Map<String, Object> signParam = new HashMap<>();
signParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
signParam.put("shareType", 1);
Response signRes = network.getResponse(signParam, BasicConfig.MOBILE_GETSHARESIGN);
HashMap data = signRes.jsonPath().getJsonObject("data");
this.shareSign = (String)data.get("shareSign");
System.out.println(shareSign);
Assert.assertNotNull(shareSign, network.message(signParam, BasicConfig.MOBILE_GETSHARESIGN, "分享失败", signRes.body().asString()));
}
//访客与代理人建立绑定关系
@Test(description = "邀请关系绑定", priority = 2)
public void 邀请关系绑定() {
Map<String, Object> bindingParam = new HashMap<>();
bindingParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
bindingParam.put("shareType", shareSign);
Response bindingRes = network.postResponse(bindingParam, BasicConfig.MOBILE_BINDING);
boolean success = bindingRes.jsonPath().getJsonObject("success");
System.out.println(success);
Assert.assertTrue(success, network.message(bindingParam, BasicConfig.MOBILE_BINDING, "绑定失败", bindingRes.body().asString()));
}
@Test(description = "预约直播间", priority = 1)
@Test(description = "预约直播间", priority = 3)
public void 预约直播间() {
Map<String, Object> sycParam = new HashMap<>();
sycParam.put("bizId", "Kj21MTg0NzE");
sycParam.put("bizId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
sycParam.put("bizType", 1);
List<Long> markIds1 = new ArrayList<>();
markIds1.add(142L);
......@@ -35,11 +64,10 @@ public class User implements AdminAuthorization{
Assert.assertNotNull(data, network.message(sycParam, BasicConfig.USER_SYCAPPOINTMENT, "预约失败", sycRes.body().asString()));
}
@Test(description = "关注直播间", priority = 2)
@Test(description = "关注直播间", priority = 4)
public void 关注直播间() {
Map<String, Object> subscribeParam = new HashMap<>();
subscribeParam.put("liveid", "Kj21MTg0NzE");
subscribeParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
List<Long> markIds2 = new ArrayList<>();
markIds2.add(146L);
markIds2.add(144L);
......@@ -50,27 +78,38 @@ public class User implements AdminAuthorization{
Assert.assertTrue(data, network.message(subscribeParam, BasicConfig.USER_SUBSCRIBE, "关注失败", subscribeRes.body().asString()));
}
@Test(description = "查询关注状态", priority = 3)
@Test(description = "查询关注状态", priority = 5)
public void 查询关注状态() {
Map<String, Object> findParam = new HashMap<>();
findParam.put("liveid", "Kj21MTg0Nzk");
Response findRes = network.postResponse(findParam, BasicConfig.USER_FIND);
findParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response findRes = network.getResponse(findParam, BasicConfig.USER_FIND);
boolean data = findRes.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(findParam, BasicConfig.USER_FIND, "关注失败", findRes.body().asString()));
}
@Test(description = "保存海报获得抽奖码", priority = 4)
@Test(description = "保存海报获得抽奖码", priority = 6)
public void 保存海报获得抽奖码() {
Map<String, Object> saveposterParam = new HashMap<>();
saveposterParam.put("liveid","Kj21MTg0Nzk");
Response saveposterRes = network.postResponse(saveposterParam, BasicConfig.USER_SAVEPOSTER);
boolean data = saveposterRes.jsonPath().getBoolean("data");
Map<String, Object> savePosterParam = new HashMap<>();
savePosterParam.put("liveId",LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response savePosterRes = network.postResponse(savePosterParam, BasicConfig.USER_SAVEPOSTER);
boolean data = savePosterRes.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(savePosterParam, BasicConfig.USER_SAVEPOSTER, "海报保存失败", savePosterRes.body().asString()));
}
@Test(description = "我的抽奖码数量", priority = 7)
public void 我的抽奖码数量() {
Map<String, Object> myCountParam = new HashMap<>();
myCountParam.put("liveId",LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response myCountRes = network.getResponse(myCountParam, BasicConfig.USER_MYCOUNT);
long data = myCountRes.jsonPath().getLong("data");
System.out.println(data);
Assert.assertTrue(data, network.message(saveposterParam, BasicConfig.USER_SAVEPOSTER, "海报保存失败", saveposterRes.body().asString()));
Assert.assertNotNull(data, network.message(myCountParam, BasicConfig.USER_MYCOUNT, "获取抽奖码数量失败", myCountRes.body().asString()));
}
}
}
......@@ -49,6 +49,7 @@ public class BasicConfig {
public static final String USER_DRAW = MOBILE_HOST + "/kjy/live/user/lottery/draw";
public static final String USER_END = MOBILE_HOST + "/kjy/live/assist/lottery/end";
public static final String USER_SAVEPOSTER = MOBILE_HOST + "/kjy/live/user/share/savePoster";
public static final String USER_MYCOUNT = MOBILE_HOST + "/kjy/live/user/lottery/myCount";
// *************** 直播管理端 ***************
public static final String MANAGER_SAVEANDUPDATE = MANAGER_HOST + "/kjy/manager/live/pre/conf/saveAndUpdate";
......
package com.kjj.utils;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import java.util.Base64;
......
......@@ -20,17 +20,23 @@
<!-- </classes>-->
<!-- </test>-->
<test preserve-order="true" name="助播-开启直播">
<test preserve-order="true" name="访客券码领取">
<classes>
<class name="com.kjj.cases.live.OpenLive"/>
<class name="com.kjj.cases.live.User"/>
</classes>
</test>
<test preserve-order="true" name="助播-结束直播">
<classes>
<class name="com.kjj.cases.live.CloseLive"/>
</classes>
</test>
<!-- <test preserve-order="true" name="助播-开启直播">-->
<!-- <classes>-->
<!-- <class name="com.kjj.cases.live.OpenLive"/>-->
<!-- </classes>-->
<!-- </test>-->
<!-- <test preserve-order="true" name="助播-结束直播">-->
<!-- <classes>-->
<!-- <class name="com.kjj.cases.live.CloseLive"/>-->
<!-- </classes>-->
<!-- </test>-->
......
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