Commit bc45e333 authored by 龚小红's avatar 龚小红

开启直播前增加校验是否有直播场次未结束

parent 5ab3e208
...@@ -3,19 +3,63 @@ import com.kjj.cases.admin.Authorization; ...@@ -3,19 +3,63 @@ import com.kjj.cases.admin.Authorization;
import com.kjj.config.BasicConfig; import com.kjj.config.BasicConfig;
import com.kjj.constants.LiveConstants; import com.kjj.constants.LiveConstants;
import com.kjj.utils.ThreadSleepUtils; import com.kjj.utils.ThreadSleepUtils;
import com.sun.org.apache.xalan.internal.xsltc.trax.XSLTCSource;
import io.restassured.response.Response; import io.restassured.response.Response;
import org.testng.Assert; import org.testng.Assert;
import org.testng.annotations.BeforeClass; import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test; import org.testng.annotations.Test;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import static com.kjj.utils.BaseUtils.ssoLogin;
public class OpenLive implements Authorization { public class OpenLive implements Authorization {
@BeforeClass @BeforeClass
public void setUp() { public void setUp() {
adminAuth(); ssoLogin();
}
@Test(description = "结束直直播中或断流中的场次", priority = 1)
public void 结束直直播中或断流中的场次() {
int totalCount2 = 0;
long liveid = 0L;
Map<String, Object> ConfDetailParam = new HashMap<>();
ConfDetailParam.put("companyId", 101);
ConfDetailParam.put("liveStatus", 3);
ConfDetailParam.put("sort", 2);
ConfDetailParam.put("liveType", 1);
ConfDetailParam.put("pageIndex", 1);
ConfDetailParam.put("pageSize", 1);
Response ConfDetailRes = network.getResponse(ConfDetailParam, BasicConfig.MANAGER_liveList);
System.out.println(ConfDetailRes.body().asString());
int totalCount1 = ConfDetailRes.jsonPath().getInt("data.totalCount");
if(totalCount1 == 0 ){
ConfDetailParam.put("liveStatus", 2);
ConfDetailRes = network.getResponse(ConfDetailParam, BasicConfig.MANAGER_liveList);
System.out.println(ConfDetailRes.body().asString());
totalCount2 = ConfDetailRes.jsonPath().getInt("data.totalCount");
if (totalCount2 == 1) {
System.out.println("有一场直播正在直播中");
liveid = ConfDetailRes.jsonPath().getLong("data.list.get(0).id");
}
}else{
System.out.println("有一场直播正在断流中");
liveid = ConfDetailRes.jsonPath().getLong("data.list.get(0).id");
}
if(totalCount1 == 1 || totalCount2 == 1){
adminAuth();
Map<String, Object> closeParam = new HashMap<>();
closeParam.put("liveid", liveid);
closeParam.put("cid", 101);
Response closeRes = network.postResponse(closeParam, BasicConfig.ANCHOR_CLOSE);
Object data = closeRes.jsonPath().getJsonObject("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(closeParam, BasicConfig.ANCHOR_CLOSE, "结束直播失败", closeRes.body().asString()));
}
} }
@Test(description = "获取直播配置详情", priority = 1)
@Test(description = "获取直播配置详情", priority = 2)
public void 获取直播配置详情() { public void 获取直播配置详情() {
Map<String, Object> ConfDetailParam = new HashMap<>(); Map<String, Object> ConfDetailParam = new HashMap<>();
ConfDetailParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey())); ConfDetailParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
...@@ -26,7 +70,7 @@ public class OpenLive implements Authorization { ...@@ -26,7 +70,7 @@ public class OpenLive implements Authorization {
} }
@Test(description = "开始直播", priority = 2) @Test(description = "开始直播", priority = 3)
public void 开启直播() { public void 开启直播() {
Map<String, Object> openParam = new HashMap<>(); Map<String, Object> openParam = new HashMap<>();
openParam.put("liveid", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey())); openParam.put("liveid", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
......
...@@ -819,7 +819,6 @@ public class SaveLive implements Authorization { ...@@ -819,7 +819,6 @@ public class SaveLive implements Authorization {
boolean hasGuessRed = response.jsonPath().getBoolean("data.hasGuessRed"); boolean hasGuessRed = response.jsonPath().getBoolean("data.hasGuessRed");
System.out.println(hasGuessRed); System.out.println(hasGuessRed);
Assert.assertTrue(hasGuessRed, network.message(listParam, BasicConfig.MOBILE_findDetail, "助播端查询直播红包配置失败", response.body().asString())); Assert.assertTrue(hasGuessRed, network.message(listParam, BasicConfig.MOBILE_findDetail, "助播端查询直播红包配置失败", response.body().asString()));
} }
......
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