Commit a9433cc1 by zhangying

修改报告报错(开课后10min之内结束直播课避免扣费导致报错)

parent b487ce65
......@@ -26,15 +26,15 @@ public class TestLargeInteractionDelCourse extends XMBaseTest {
}
/**
* 大班互动直播课-删除上课中的课程
* 大班互动直播课-删除未成功开课的课程
*/
@Test(description = "大班互动直播课-删除未成功开课的课程")
public void testGetCourseDetail() {
GetLiveCourseData getLiveCourseData = new GetLiveCourseData();
JSONObject getLargeCourseData = getLiveCourseData.getInteractionClassLiveListWithStatus("EXPIRED");
System.out.println("getLargeCourseData =="+getLargeCourseData);
JSONObject getInteractionCourseData = getLiveCourseData.getInteractionClassLiveListWithStatus("EXPIRED");
System.out.println("getInteractionCourseData =="+getInteractionCourseData);
String liveCourseId = getLargeCourseData.getJSONObject("result").getJSONArray("records").getJSONObject(0).getString("liveCourseId");
String liveCourseId = getInteractionCourseData.getJSONObject("result").getJSONArray("records").getJSONObject(0).getString("liveCourseId");
System.out.println("liveCourseId ="+liveCourseId);
JSONObject jsonObject = new JSONObject();
......@@ -149,6 +149,8 @@ public class TestLargeInteractionDelCourse extends XMBaseTest {
String liveCourseId1 = getLargeCourseData1.getJSONObject("result").getJSONArray("records").getJSONObject(0).getString("liveCourseId");
System.out.println("liveCourseId1 =="+liveCourseId1);
JSONObject finishCourse = getLiveCourseData.changeCourseStateToFinish(liveCourseId1);
Assert.assertEquals("false", jsonBody.getString("success"));
Assert.assertEquals("删除课程处于上课中状态", jsonBody.getString("message"));
}
......
......@@ -28,7 +28,7 @@ public class TestChangeCourseState extends XMBaseTest {
}
/**
* 测试改变直播课次状态
* 测试改变直播课次状态-开始直播
*/
@Test
public void testChangeCourseState() throws InterruptedException {
......@@ -54,4 +54,32 @@ public class TestChangeCourseState extends XMBaseTest {
}
/**
* 测试改变直播课次状态-结束直播
*/
@Test(description = "修改课程状态为结束")
public void testChangeCourseState1() throws InterruptedException {
GetLiveCourseData getLiveCourseData=new GetLiveCourseData();
JSONObject getInteractionCourseData = getLiveCourseData.getInteractionClassLiveListWithStatus("STARTING");
String liveCourseId = getInteractionCourseData.getJSONObject("result").getJSONArray("records").getJSONObject(0).getString("liveCourseId");
System.out.println("liveCourseId ="+liveCourseId);
JSONObject jsonObject = new JSONObject();
jsonObject.put("liveCourseId",liveCourseId);
jsonObject.put("courseState","FINISH");
xmAppApi.doRequest(RequestType.JSON, params, jsonObject.toJSONString(), headers);
JSONObject jsonBody = xmAppApi.getBodyInJSON();
JSONObject classLiveList = getLiveCourseData.getLargeClassLiveList();
Assert.assertEquals("true", jsonBody.getString("success"));
Assert.assertEquals("操作成功!", jsonBody.getString("message"));
Assert.assertEquals("STARTING", classLiveList.getJSONObject("result").getJSONArray("records").getJSONObject(0).getString("courseState"));
Assert.assertEquals(liveCourseId,classLiveList.getJSONObject("result").getJSONArray("records").getJSONObject(0).getString("liveCourseId"));
}
}
......@@ -126,6 +126,26 @@ public class GetLiveCourseData extends XMBaseTest {
return liveCourseList;
}
public JSONObject changeCourseStateToFinish(String liveCourseId) {
dataApi.setApiModule(ApiModele.CloudClass_apollo) // API 所属模块 必传 读取配置文件config.properties配置的api地址
.setApiName("api_changeCourseState") // API 名称 必传
.setLoginUser("zhangy-b") // http 接口,测试账号 必传
.setTerminal(Terminal.B); // 所属端位(B端,C端,M端等, 必传)
super.beforeDataRequest();
JSONObject jsonObject = new JSONObject();
jsonObject.put("liveCourseId",liveCourseId);
jsonObject.put("courseState","FINISH");
dataApi.doRequest(RequestType.JSON, params, jsonObject.toJSONString(), dataheadrs);
System.out.println(dataApi);
JSONObject liveCourseList=dataApi.getBodyInJSON();
return liveCourseList;
}
public JSONObject createLargeClassLive() throws InterruptedException {
dataApi.setApiModule(ApiModele.CloudClass_B)
.setApiName("API_createLargeClassLive")
......
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