Commit 5b1a2f8e by fanyuanmeng

create:新增接口

parent 2b46af01
...@@ -36,7 +36,7 @@ public class TestCreateSeries extends XMBaseTest { ...@@ -36,7 +36,7 @@ public class TestCreateSeries extends XMBaseTest {
@Test @Test
public void testCreateSeries(){ public void testCreateSeries(){
String seriesName = RandomStringUtil.randomNumber(25,"seriescourse_"); String seriesName = RandomStringUtil.randomNumber(20,"series_");
Map mediaMap = new HashMap(); Map mediaMap = new HashMap();
......
package com.live.cases.seriesCourse;
import com.alibaba.fastjson.JSONObject;
import com.live.enums.ApiModele;
import com.live.enums.RequestType;
import com.live.enums.Terminal;
import com.live.utils.XMBaseTest;
import com.live.xmutils.GetSeriesCourseData;
import org.testng.Assert;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import java.util.HashMap;
import java.util.Map;
/**
* @author fym
* @date 2021/2/24 3:32 下午
*/
public class TestDelSeries extends XMBaseTest {
@BeforeMethod
public void beforeTest() {
xmAppApi.setApiModule(ApiModele.CloudClass_Series) // API 所属模块 必传 读取配置文件config.properties配置的api地址
.setApiName("API_delSeries") // API 名称 必传
.setLoginUser("fym-b") // http 接口,测试账号 必传
.setTerminal(Terminal.B); // 所属端位(B端,C端,M端等, 必传)
dal.setCase_owner("樊圆梦");
super.beforeTest();
}
@Test
public void testDelSeries(){
GetSeriesCourseData getSeriesCourseData = new GetSeriesCourseData();
String seriesId = getSeriesCourseData.getSeriesPage().getJSONObject("result").getJSONArray("records").getJSONObject(3).getString("id");
String total0 = getSeriesCourseData.getSeriesPage().getJSONObject("result").getString("total");
int a = Integer.parseInt(total0);
Map bodyMap = new HashMap();
bodyMap.put("seriesId",seriesId);
bodyMap.put("instId",xmAppApi.getLoginInfo().getInstId());
JSONObject jsonObject = new JSONObject(bodyMap);
String bodyData = jsonObject.toString();
xmAppApi.doRequest(RequestType.JSON, params, bodyData, headers);
System.out.println(xmAppApi);
String total = getSeriesCourseData.getSeriesPage().getJSONObject("result").getString("total");
int b = Integer.parseInt(total);
Assert.assertEquals(a-1,b);
}
}
package com.live.cases.seriesCourse;
import com.alibaba.fastjson.JSONObject;
import com.live.enums.ApiModele;
import com.live.enums.RequestType;
import com.live.enums.Terminal;
import com.live.utils.RandomStringUtil;
import com.live.utils.XMBaseTest;
import com.live.xmutils.GetSeriesCourseData;
import org.testng.Assert;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author fym
* @date 2021/2/24 10:06 上午
*/
public class TestEditSeries extends XMBaseTest {
@BeforeMethod
public void beforeTest() {
xmAppApi.setApiModule(ApiModele.CloudClass_Series) // API 所属模块 必传 读取配置文件config.properties配置的api地址
.setApiName("API_editSeries") // API 名称 必传
.setLoginUser("fym-b") // http 接口,测试账号 必传
.setTerminal(Terminal.B); // 所属端位(B端,C端,M端等, 必传)
dal.setCase_owner("樊圆梦");
super.beforeTest();
}
@Test
public void testEditSeries(){
GetSeriesCourseData getSeriesCourseData = new GetSeriesCourseData();
String id = getSeriesCourseData.createSeriesCourse();
String seriesName = RandomStringUtil.randomNumber(20,"series_edit");
Map Media = new HashMap();
Media.put("mediaContent","这是系列课简介<p><br></p>");
Media.put("mediaType","TEXT");
Media.put("contentType","INTRO");
Media.put("mediaContentLength",7);
List scheduleMedia = new ArrayList();
scheduleMedia.add(Media);
Map bodyMap = new HashMap();
bodyMap.put("id",id);
bodyMap.put("instId",xmAppApi.getLoginInfo().getInstId());
bodyMap.put("teacherId",xmAppApi.getLoginInfo().getTid());
bodyMap.put("coverId","1362677307414863873");
bodyMap.put("joinType","ALL");
bodyMap.put("smsCheck","VALID");
bodyMap.put("showType","LOCK");
bodyMap.put("enableJoinStuIds",new ArrayList<>());
bodyMap.put("joinStudentIds",new ArrayList<>());
bodyMap.put("seriesName",seriesName);
bodyMap.put("scheduleMedia",scheduleMedia);
JSONObject jsonObject = new JSONObject(bodyMap);
String bodyData = jsonObject.toString();
xmAppApi.doRequest(RequestType.JSON, params, bodyData, headers);
System.out.println(xmAppApi);
com.alibaba.fastjson.JSONObject jsonBody = xmAppApi.getBodyInJSON();
JSONObject seriesPage = getSeriesCourseData.getSeriesPage();
Assert.assertEquals(id,seriesPage.getJSONObject("result").getJSONArray("records").getJSONObject(0).getString("id"));
}
}
package com.live.cases.seriesCourse;
import com.alibaba.fastjson.JSONObject;
import com.live.enums.ApiModele;
import com.live.enums.RequestType;
import com.live.enums.Terminal;
import com.live.utils.XMBaseTest;
import com.live.xmutils.GetSeriesCourseData;
import com.live.xmutils.GetVideoClassData;
import org.testng.Assert;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author fym
* @date 2021/2/23 3:41 下午
*/
public class TestEditSeriesSchedule extends XMBaseTest {
@BeforeMethod
public void beforeTest() {
xmAppApi.setApiModule(ApiModele.CloudClass_Series) // API 所属模块 必传 读取配置文件config.properties配置的api地址
.setApiName("API_editSeriesSchedule") // API 名称 必传
.setLoginUser("fym-b") // http 接口,测试账号 必传
.setTerminal(Terminal.B); // 所属端位(B端,C端,M端等, 必传)
dal.setCase_owner("樊圆梦");
super.beforeTest();
}
@Test
public void testEditSeriesSchedule(){
GetVideoClassData getVideoClassData = new GetVideoClassData();
String scheduleId = getVideoClassData.VideoClassData().getJSONObject("result").getJSONArray("records").getJSONObject(0).getString("id");
GetSeriesCourseData getSeriesCourseData = new GetSeriesCourseData();
String seriesId = getSeriesCourseData.createSeriesCourse();
List scheduleIds = new ArrayList();
scheduleIds.add(scheduleId);
Map bodyMap = new HashMap();
bodyMap.put("seriesId",seriesId);
bodyMap.put("scheduleIds",scheduleIds);
JSONObject jsonObject = new JSONObject(bodyMap);
String bodyData = jsonObject.toString();
xmAppApi.doRequest(RequestType.JSON, params, bodyData, headers);
System.out.println(xmAppApi);
JSONObject jsonBody = xmAppApi.getBodyInJSON();
Assert.assertEquals("true", jsonBody.getString("success"));
Assert.assertEquals("200", jsonBody.getString("code"));
Assert.assertEquals("操作成功!", jsonBody.getString("message"));
}
}
package com.live.cases.seriesCourse;
import com.alibaba.fastjson.JSONObject;
import com.live.enums.ApiModele;
import com.live.enums.RequestType;
import com.live.enums.Terminal;
import com.live.utils.XMBaseTest;
import com.live.xmutils.GetSeriesCourseData;
import org.testng.Assert;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author fym
* @date 2021/2/24 11:45 上午
*/
public class TestGetSeriesScheduleIdList extends XMBaseTest {
@BeforeMethod
public void beforeTest() {
xmAppApi.setApiModule(ApiModele.CloudClass_Series) // API 所属模块 必传 读取配置文件config.properties配置的api地址
.setApiName("API_getSeriesScheduleIdList") // API 名称 必传
.setLoginUser("fym-b") // http 接口,测试账号 必传
.setTerminal(Terminal.B); // 所属端位(B端,C端,M端等, 必传)
dal.setCase_owner("樊圆梦");
super.beforeTest();
}
@Test
public void testGetSeriesScheduleIdList(){
GetSeriesCourseData getSeriesCourseData = new GetSeriesCourseData();
Map idMap = getSeriesCourseData.editSeriesSchedule();
String seriesId = idMap.get("seriesId").toString();
String scheduleId = idMap.get("scheduleId").toString();
Map bodyMap = new HashMap();
bodyMap.put("seriesId",seriesId);
bodyMap.put("instId",xmAppApi.getLoginInfo().getInstId());
JSONObject jsonObject = new JSONObject(bodyMap);
String bodyData = jsonObject.toString();
xmAppApi.doRequest(RequestType.JSON, params, bodyData, headers);
System.out.println(xmAppApi);
JSONObject jsonBody0 = xmAppApi.getBodyInJSON();
String scheduleId0 = jsonBody0.getJSONArray("result").getString(0);
Assert.assertEquals(scheduleId,scheduleId0);
}
}
package com.live.cases.seriesCourse;
import com.alibaba.fastjson.JSONObject;
import com.live.enums.ApiModele;
import com.live.enums.RequestType;
import com.live.enums.Terminal;
import com.live.utils.XMBaseTest;
import com.live.xmutils.GetSeriesCourseData;
import org.testng.Assert;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import java.util.HashMap;
import java.util.Map;
/**
* @author fym
* @date 2021/2/24 2:55 下午
*/
public class TestMoveSeries extends XMBaseTest {
@BeforeMethod
public void beforeTest() {
xmAppApi.setApiModule(ApiModele.CloudClass_Series) // API 所属模块 必传 读取配置文件config.properties配置的api地址
.setApiName("API_moveSeries") // API 名称 必传
.setLoginUser("fym-b") // http 接口,测试账号 必传
.setTerminal(Terminal.B); // 所属端位(B端,C端,M端等, 必传)
dal.setCase_owner("樊圆梦");
super.beforeTest();
}
@Test
public void testMoveSeriesUP(){
GetSeriesCourseData getSeriesCourseData = new GetSeriesCourseData();
//获取当前系列课列表第一页的第2个课次
String seriesId = getSeriesCourseData.getSeriesPage().getJSONObject("result").getJSONArray("records").getJSONObject(1).getString("id");
Map bodyMap = new HashMap();
bodyMap.put("seriesId",seriesId);
bodyMap.put("move","UP");
JSONObject jsonObject = new JSONObject(bodyMap);
String bodyData = jsonObject.toString();
xmAppApi.doRequest(RequestType.JSON, params, bodyData, headers);
System.out.println(xmAppApi);
JSONObject jsonBody = xmAppApi.getBodyInJSON();
String seriesIdUp = getSeriesCourseData.getSeriesPage().getJSONObject("result").getJSONArray("records").getJSONObject(0).getString("id");
Assert.assertEquals(seriesId,seriesIdUp);
}
@Test
public void testMoveSeriesDown(){
GetSeriesCourseData getSeriesCourseData = new GetSeriesCourseData();
//获取当前系列课列表第一页的第1个课次
String seriesId = getSeriesCourseData.getSeriesPage().getJSONObject("result").getJSONArray("records").getJSONObject(0).getString("id");
Map bodyMap = new HashMap();
bodyMap.put("seriesId",seriesId);
bodyMap.put("move","DOWN");
JSONObject jsonObject = new JSONObject(bodyMap);
String bodyData = jsonObject.toString();
xmAppApi.doRequest(RequestType.JSON, params, bodyData, headers);
System.out.println(xmAppApi);
JSONObject jsonBody = xmAppApi.getBodyInJSON();
String seriesIdDown = getSeriesCourseData.getSeriesPage().getJSONObject("result").getJSONArray("records").getJSONObject(1).getString("id");
Assert.assertEquals(seriesId,seriesIdDown);
}
}
package com.live.cases.seriesCourse;
import com.alibaba.fastjson.JSONObject;
import com.live.enums.ApiModele;
import com.live.enums.RequestType;
import com.live.enums.Terminal;
import com.live.utils.XMBaseTest;
import com.live.xmutils.GetSeriesCourseData;
import org.testng.Assert;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import java.util.HashMap;
import java.util.Map;
/**
* @author fym
* @date 2021/2/24 3:49 下午
*/
public class TestMoveSeriesSchedule extends XMBaseTest {
@BeforeMethod
public void beforeTest() {
xmAppApi.setApiModule(ApiModele.CloudClass_Series) // API 所属模块 必传 读取配置文件config.properties配置的api地址
.setApiName("API_moveSeriesSchedule") // API 名称 必传
.setLoginUser("fym-b") // http 接口,测试账号 必传
.setTerminal(Terminal.B); // 所属端位(B端,C端,M端等, 必传)
dal.setCase_owner("樊圆梦");
super.beforeTest();
}
@Test
public void testMoveSeriesSchedule1(){
GetSeriesCourseData getSeriesCourseData = new GetSeriesCourseData();
String seriesId = getSeriesCourseData.getSeriesScheduleIdList().getString("seriesId");
String scheduleId = getSeriesCourseData.getSeriesScheduleIdList().getJSONArray("result").getString(1);
Map bodyMap = new HashMap();
bodyMap.put("seriesId",seriesId);
bodyMap.put("scheduleId",scheduleId);
bodyMap.put("newSequence",1);
JSONObject jsonObject = new JSONObject(bodyMap);
String bodyData = jsonObject.toString();
xmAppApi.doRequest(RequestType.JSON, params, bodyData, headers);
System.out.println(xmAppApi);
com.alibaba.fastjson.JSONObject jsonBody = xmAppApi.getBodyInJSON();
Assert.assertEquals("true", jsonBody.getString("success"));
Assert.assertEquals("200", jsonBody.getString("code"));
Assert.assertEquals("操作成功!", jsonBody.getString("message"));
}
@Test
public void testMoveSeriesSchedule2(){
GetSeriesCourseData getSeriesCourseData = new GetSeriesCourseData();
String seriesId = getSeriesCourseData.getSeriesScheduleIdList().getString("seriesId");
String scheduleId = getSeriesCourseData.getSeriesScheduleIdList().getJSONArray("result").getString(0);
Map bodyMap = new HashMap();
bodyMap.put("seriesId",seriesId);
bodyMap.put("scheduleId",scheduleId);
bodyMap.put("newSequence",2);
JSONObject jsonObject = new JSONObject(bodyMap);
String bodyData = jsonObject.toString();
xmAppApi.doRequest(RequestType.JSON, params, bodyData, headers);
System.out.println(xmAppApi);
com.alibaba.fastjson.JSONObject jsonBody = xmAppApi.getBodyInJSON();
Assert.assertEquals("true", jsonBody.getString("success"));
Assert.assertEquals("200", jsonBody.getString("code"));
Assert.assertEquals("操作成功!", jsonBody.getString("message"));
}
}
package com.live.cases.seriesCourse;
import com.alibaba.fastjson.JSONObject;
import com.live.enums.ApiModele;
import com.live.enums.RequestType;
import com.live.enums.Terminal;
import com.live.utils.XMBaseTest;
import com.live.xmutils.GetSeriesCourseData;
import org.testng.Assert;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import java.util.HashMap;
import java.util.Map;
/**
* @author fym
* @date 2021/2/23 9:52 上午
*/
public class TestSeriesDetail extends XMBaseTest {
@BeforeMethod
public void beforeTest() {
xmAppApi.setApiModule(ApiModele.CloudClass_Series) // API 所属模块 必传 读取配置文件config.properties配置的api地址
.setApiName("API_seriesDetail") // API 名称 必传
.setLoginUser("fym-b") // http 接口,测试账号 必传
.setTerminal(Terminal.B); // 所属端位(B端,C端,M端等, 必传)
dal.setCase_owner("樊圆梦");
super.beforeTest();
}
@Test
public void testSeriesDetail(){
GetSeriesCourseData getSeriesCourseData = new GetSeriesCourseData();
String seriesId = getSeriesCourseData.createSeriesCourse();
Map bodyMap = new HashMap();
bodyMap.put("seriesId",seriesId);
bodyMap.put("instId",xmAppApi.getLoginInfo().getInstId());
JSONObject jsonObject = new JSONObject(bodyMap);
String bodyData = jsonObject.toString();
xmAppApi.doRequest(RequestType.JSON, params, bodyData, headers);
System.out.println(xmAppApi);
JSONObject jsonBody0 = xmAppApi.getBodyInJSON();
String id = jsonBody0.getJSONObject("result").getString("id");
Assert.assertEquals(seriesId,id);
}
}
package com.live.cases.seriesCourse;
import com.alibaba.fastjson.JSONObject;
import com.live.enums.ApiModele;
import com.live.enums.RequestType;
import com.live.enums.Terminal;
import com.live.utils.XMBaseTest;
import com.live.xmutils.GetSeriesCourseData;
import org.testng.Assert;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import java.util.HashMap;
import java.util.Map;
/**
* @author fym
* @date 2021/2/24 11:25 上午
*/
public class TestSeriesSchedulePage extends XMBaseTest {
@BeforeMethod
public void beforeTest() {
xmAppApi.setApiModule(ApiModele.CloudClass_Series) // API 所属模块 必传 读取配置文件config.properties配置的api地址
.setApiName("API_seriesSchedulePage") // API 名称 必传
.setLoginUser("fym-b") // http 接口,测试账号 必传
.setTerminal(Terminal.B); // 所属端位(B端,C端,M端等, 必传)
dal.setCase_owner("樊圆梦");
super.beforeTest();
}
@Test
public void testSeriesSchedulePage(){
GetSeriesCourseData getSeriesCourseData = new GetSeriesCourseData();
Map idMap = getSeriesCourseData.editSeriesSchedule();
String seriesId = idMap.get("seriesId").toString();
Map bodyMap = new HashMap();
bodyMap.put("seriesId",seriesId);
bodyMap.put("size",10);
bodyMap.put("current",1);
bodyMap.put("scheduleName","");
JSONObject jsonObject = new JSONObject(bodyMap);
String bodyData = jsonObject.toString();
xmAppApi.doRequest(RequestType.JSON, params, bodyData, headers);
System.out.println(xmAppApi);
JSONObject jsonBody0 = xmAppApi.getBodyInJSON();
Assert.assertEquals("1",jsonBody0.getJSONObject("result").getString("total"));
}
}
package com.live.cases.videoClass; package com.live.cases.videoCourse;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.live.enums.ApiModele; import com.live.enums.ApiModele;
...@@ -6,7 +6,6 @@ import com.live.enums.RequestType; ...@@ -6,7 +6,6 @@ import com.live.enums.RequestType;
import com.live.enums.Terminal; import com.live.enums.Terminal;
import com.live.utils.XMBaseTest; import com.live.utils.XMBaseTest;
import com.live.xmutils.GetVideoClassData; import com.live.xmutils.GetVideoClassData;
import net.minidev.json.JSONUtil;
import org.testng.Assert; import org.testng.Assert;
import org.testng.annotations.BeforeMethod; import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test; import org.testng.annotations.Test;
......
package com.live.cases.videoClass; package com.live.cases.videoCourse;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.live.enums.ApiModele; import com.live.enums.ApiModele;
......
package com.live.cases.videoClass; package com.live.cases.videoCourse;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.live.enums.ApiModele; import com.live.enums.ApiModele;
......
package com.live.cases.videoCourse;
import com.alibaba.fastjson.JSONObject;
import com.live.enums.ApiModele;
import com.live.enums.RequestType;
import com.live.enums.Terminal;
import com.live.utils.XMBaseTest;
import com.live.xmutils.GetVideoClassData;
import org.testng.Assert;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import java.util.HashMap;
import java.util.Map;
/**
* @author fym
* @date 2021/2/21 6:04 下午
*/
public class TestExportVideoScheduleSync extends XMBaseTest {
@BeforeMethod
public void beforeTest() {
xmAppApi.setApiModule(ApiModele.CloudClass_Video) // API 所属模块 必传 读取配置文件config.properties配置的api地址
.setApiName("API_exportVideoScheduleSync") // API 名称 必传
.setLoginUser("fym-b") // http 接口,测试账号 必传
.setTerminal(Terminal.B); // 所属端位(B端,C端,M端等, 必传)
dal.setCase_owner("樊圆梦");
super.beforeTest();
}
@Test
public void testExportVideoScheduleSync() throws InterruptedException {
GetVideoClassData getVideoClassData = new GetVideoClassData();
String liveCourseId = getVideoClassData.addLessonScheduleStu();
Map bodyMap = new HashMap();
bodyMap.put("liveCourseId",liveCourseId);
JSONObject jsonObject = new JSONObject(bodyMap);
String bodyData = jsonObject.toString();
xmAppApi.doRequest(RequestType.JSON, params, bodyData, headers);
System.out.println(xmAppApi);
com.alibaba.fastjson.JSONObject jsonBody0 = xmAppApi.getBodyInJSON();
Assert.assertEquals("true", jsonBody0.getString("success"));
Assert.assertEquals("操作成功!", jsonBody0.getString("message"));
Assert.assertEquals("200", jsonBody0.getString("code"));
}
}
package com.live.cases.videoClass; package com.live.cases.videoCourse;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.live.enums.ApiModele; import com.live.enums.ApiModele;
......
package com.live.cases.videoClass; package com.live.cases.videoCourse;
import com.alibaba.fastjson.JSONObject;
import com.live.enums.ApiModele; import com.live.enums.ApiModele;
import com.live.enums.RequestType; import com.live.enums.RequestType;
import com.live.enums.Terminal; import com.live.enums.Terminal;
......
package com.live.cases.videoCourse;
import com.live.enums.ApiModele;
import com.live.enums.RequestType;
import com.live.enums.Terminal;
import com.live.utils.XMBaseTest;
import com.live.xmutils.GetVideoClassData;
import org.json.JSONObject;
import org.testng.Assert;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import java.util.HashMap;
import java.util.Map;
/**
* @author fym
* @date 2021/2/23 11:47 上午
*/
public class TestGetLessonStuIdListByScheduleId extends XMBaseTest {
@BeforeMethod
public void beforeTest() {
xmAppApi.setApiModule(ApiModele.CloudClass_Video) // API 所属模块 必传 读取配置文件config.properties配置的api地址
.setApiName("API_getLessonStuIdListByScheduleId") // API 名称 必传
.setLoginUser("fym-b") // http 接口,测试账号 必传
.setTerminal(Terminal.B); // 所属端位(B端,C端,M端等, 必传)
dal.setCase_owner("樊圆梦");
super.beforeTest();
}
@Test
public void testGetLessonStuIdListByScheduleId() throws InterruptedException {
GetVideoClassData getVideoClassData = new GetVideoClassData();
String scheduleId = getVideoClassData.addLessonScheduleStu();
Map bodyMap = new HashMap();
bodyMap.put("scheduleId",scheduleId);
JSONObject jsonObject = new JSONObject(bodyMap);
String bodyData = jsonObject.toString();
xmAppApi.doRequest(RequestType.JSON, params, bodyData, headers);
System.out.println(xmAppApi);
com.alibaba.fastjson.JSONObject jsonBody = xmAppApi.getBodyInJSON();
Assert.assertEquals("1308376918943268866",jsonBody.getJSONArray("result").getString(0));
}
}
package com.live.cases.videoClass; package com.live.cases.videoCourse;
import com.live.enums.ApiModele; import com.live.enums.ApiModele;
import com.live.enums.RequestType; import com.live.enums.RequestType;
import com.live.enums.Terminal; import com.live.enums.Terminal;
import com.live.utils.XMBaseTest; import com.live.utils.XMBaseTest;
import jdk.nashorn.internal.runtime.options.LoggingOption;
import org.json.JSONObject; import org.json.JSONObject;
import org.testng.Assert; import org.testng.Assert;
import org.testng.annotations.BeforeMethod; import org.testng.annotations.BeforeMethod;
......
package com.live.cases.videoClass; package com.live.cases.videoCourse;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.live.enums.ApiModele; import com.live.enums.ApiModele;
......
package com.live.cases.videoClass; package com.live.cases.videoCourse;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.live.client.XMAppApi;
import com.live.enums.ApiModele; import com.live.enums.ApiModele;
import com.live.enums.RequestType; import com.live.enums.RequestType;
import com.live.enums.Terminal; import com.live.enums.Terminal;
......
...@@ -4,9 +4,12 @@ import com.alibaba.fastjson.JSONObject; ...@@ -4,9 +4,12 @@ import com.alibaba.fastjson.JSONObject;
import com.live.enums.ApiModele; import com.live.enums.ApiModele;
import com.live.enums.RequestType; import com.live.enums.RequestType;
import com.live.enums.Terminal; import com.live.enums.Terminal;
import com.live.utils.RandomStringUtil;
import com.live.utils.XMBaseTest; import com.live.utils.XMBaseTest;
import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
...@@ -51,5 +54,167 @@ public class GetSeriesCourseData extends XMBaseTest { ...@@ -51,5 +54,167 @@ public class GetSeriesCourseData extends XMBaseTest {
} }
public String createSeriesCourse(){
dataApi.setApiModule(ApiModele.CloudClass_Series) // API 所属模块 必传 读取配置文件config.properties配置的api地址
.setApiName("API_createSeries") // API 名称 必传
.setLoginUser("fym-b") // http 接口,测试账号 必传
.setTerminal(Terminal.B); // 所属端位(B端,C端,M端等, 必传)
super.beforeDataRequest();
String seriesName = RandomStringUtil.randomNumber(20,"series_");
Map mediaMap = new HashMap();
mediaMap.put("mediaType","TEXT");
mediaMap.put("mediaContent","这是系列课简介");
mediaMap.put("key","sCJFBRyjFTzxcXCR");
mediaMap.put("mediaContentLength",7);
List scheduleMedia = new ArrayList();
scheduleMedia.add(mediaMap);
List enableJoinStuIds = new ArrayList();
List joinStudentIds = new ArrayList();
Map bodyMap = new HashMap();
bodyMap.put("seriesName",seriesName);
bodyMap.put("instId", dataApi.getLoginInfo().getInstId());
bodyMap.put("teacherId",dataApi.getLoginInfo().getTid());
bodyMap.put("coverId","1362677307414863873");
bodyMap.put("joinType","ALL");
bodyMap.put("smsCheck","VALID");
bodyMap.put("showType","LOCK");
bodyMap.put("scheduleMedia",scheduleMedia);
bodyMap.put("joinStudentIds",joinStudentIds);
bodyMap.put("enableJoinStuIds",enableJoinStuIds);
JSONObject jsonObject = new JSONObject(bodyMap);
String bodyData = jsonObject.toString();
dataApi.doRequest(RequestType.JSON, params, bodyData, headers);
System.out.println(dataApi);
com.alibaba.fastjson.JSONObject jsonBody = dataApi.getBodyInJSON();
String seriesId = jsonBody.getString("result");
return seriesId;
}
//一个系列课里有一个视频课
public Map editSeriesSchedule(){
GetVideoClassData getVideoClassData = new GetVideoClassData();
String scheduleId = getVideoClassData.VideoClassData().getJSONObject("result").getJSONArray("records").getJSONObject(0).getString("id");
String seriesId = createSeriesCourse();
dataApi.setApiModule(ApiModele.CloudClass_Series) // API 所属模块 必传 读取配置文件config.properties配置的api地址
.setApiName("API_editSeriesSchedule") // API 名称 必传
.setLoginUser("fym-b") // http 接口,测试账号 必传
.setTerminal(Terminal.B); // 所属端位(B端,C端,M端等, 必传)
super.beforeDataRequest();
List scheduleIds = new ArrayList();
scheduleIds.add(scheduleId);
Map bodyMap = new HashMap();
bodyMap.put("seriesId",seriesId);
bodyMap.put("scheduleIds",scheduleIds);
JSONObject jsonObject = new JSONObject(bodyMap);
String bodyData = jsonObject.toString();
dataApi.doRequest(RequestType.JSON, params, bodyData, headers);
System.out.println(dataApi);
com.alibaba.fastjson.JSONObject jsonBody = dataApi.getBodyInJSON();
Map dataMap = new HashMap();
dataMap.put("seriesId",seriesId);
dataMap.put("scheduleId",scheduleId);
return dataMap;
}
public Map editSeriesSchedule2(){
//取出视频课列表前两个ID
GetVideoClassData getVideoClassData = new GetVideoClassData();
String scheduleId0 = getVideoClassData.VideoClassData().getJSONObject("result").getJSONArray("records").getJSONObject(0).getString("id");
String scheduleId1 = getVideoClassData.VideoClassData().getJSONObject("result").getJSONArray("records").getJSONObject(1).getString("id");
String seriesId = createSeriesCourse();
dataApi.setApiModule(ApiModele.CloudClass_Series) // API 所属模块 必传 读取配置文件config.properties配置的api地址
.setApiName("API_editSeriesSchedule") // API 名称 必传
.setLoginUser("fym-b") // http 接口,测试账号 必传
.setTerminal(Terminal.B); // 所属端位(B端,C端,M端等, 必传)
super.beforeDataRequest();
List scheduleIds = new ArrayList();
scheduleIds.add(scheduleId0);
scheduleIds.add(scheduleId1);
Map bodyMap = new HashMap();
bodyMap.put("seriesId",seriesId);
bodyMap.put("scheduleIds",scheduleIds);
JSONObject jsonObject = new JSONObject(bodyMap);
String bodyData = jsonObject.toString();
dataApi.doRequest(RequestType.JSON, params, bodyData, headers);
System.out.println(dataApi);
com.alibaba.fastjson.JSONObject jsonBody = dataApi.getBodyInJSON();
Map dataMap = new HashMap();
dataMap.put("seriesId",seriesId);
dataMap.put("scheduleIds",scheduleIds);
return dataMap;
}
public JSONObject getSeriesScheduleIdList(){
Map data = editSeriesSchedule2();
String seriesId = data.get("seriesId").toString();
dataApi.setApiModule(ApiModele.CloudClass_Series) // API 所属模块 必传 读取配置文件config.properties配置的api地址
.setApiName("API_getSeriesScheduleIdList") // API 名称 必传
.setLoginUser("fym-b") // http 接口,测试账号 必传
.setTerminal(Terminal.B); // 所属端位(B端,C端,M端等, 必传)
super.beforeDataRequest();
Map bodyMap = new HashMap();
bodyMap.put("seriesId",seriesId);
bodyMap.put("instId",dataApi.getLoginInfo().getInstId());
JSONObject jsonObject = new JSONObject(bodyMap);
String bodyData = jsonObject.toString();
dataApi.doRequest(RequestType.JSON, params, bodyData, headers);
System.out.println(dataApi);
com.alibaba.fastjson.JSONObject jsonBody = dataApi.getBodyInJSON();
jsonBody.put("seriesId",seriesId);
return jsonBody;
}
} }
...@@ -81,5 +81,11 @@ ...@@ -81,5 +81,11 @@
"apiContentType": "", "apiContentType": "",
"apiName": "移出视频课学员", "apiName": "移出视频课学员",
"desc": "移出视频课学员" "desc": "移出视频课学员"
},
"API_exportVideoScheduleSync": {
"apiPath": "/apollo/public/apollo/exportVideoScheduleSync",
"apiContentType": "",
"apiName": "导出学生观看视频课数据",
"desc": "导出学生观看视频课数据"
} }
} }
\ No newline at end of file
...@@ -12,6 +12,62 @@ ...@@ -12,6 +12,62 @@
"apiContentType": "application/json;charset=utf-8", "apiContentType": "application/json;charset=utf-8",
"apiName": "系列课列表", "apiName": "系列课列表",
"desc": "系列课列表" "desc": "系列课列表"
} },
"API_seriesDetail":
{
"apiPath": "/apollo/public/apollo/seriesDetail",
"apiContentType": "application/json;charset=utf-8",
"apiName": "系列课详情",
"desc": "系列课详情"
},
"API_editSeriesSchedule":
{
"apiPath": "/apollo/public/apollo/editSeriesSchedule",
"apiContentType": "application/json;charset=utf-8",
"apiName": "编辑系列课次",
"desc": "编辑系列课次"
},
"API_editSeries":
{
"apiPath": "/apollo/public/apollo/editSeries",
"apiContentType": "application/json;charset=utf-8",
"apiName": "编辑系列课",
"desc": "编辑系列课"
},
"API_seriesSchedulePage":
{
"apiPath": "/apollo/public/apollo/seriesSchedulePage",
"apiContentType": "application/json;charset=utf-8",
"apiName": "系列课内视频课列表",
"desc": "系列课内视频课列表"
},
"API_getSeriesScheduleIdList":
{
"apiPath": "/apollo/public/apollo/getSeriesScheduleIdList",
"apiContentType": "application/json;charset=utf-8",
"apiName": "获取系列课内视频课的所有id",
"desc": "获取系列课内视频课的所有id"
},
"API_moveSeries":
{
"apiPath": "/apollo/public/apollo/moveSeries",
"apiContentType": "application/json;charset=utf-8",
"apiName": "移动系列课顺序",
"desc": "移动系列课顺序"
},
"API_delSeries":
{
"apiPath": "/apollo/public/apollo/delSeries",
"apiContentType": "application/json;charset=utf-8",
"apiName": "删除系列课",
"desc": "删除系列课"
},
"API_moveSeriesSchedule":
{
"apiPath": "/apollo/public/apollo/moveSeriesSchedule",
"apiContentType": "application/json;charset=utf-8",
"apiName": "移动系列课内视频课顺序",
"desc": "移动系列课内视频课顺序"
}
} }
\ No newline at end of file
...@@ -49,7 +49,7 @@ ...@@ -49,7 +49,7 @@
</test> </test>
<test name="videoClass" preserve-order="true" verbose="3"> <test name="videoClass" preserve-order="true" verbose="3">
<packages> <packages>
<package name="com.live.cases.videoClass"></package> <package name="com.live.cases.videoCourse"></package>
</packages> </packages>
</test> </test>
</suite> </suite>
\ No newline at end of file
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