Commit afa71f29 by zhangying

review

parent 04f15b11
package com.live.cases.musicPlay;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.live.enums.ApiModele;
import com.live.enums.RequestType;
......@@ -28,25 +29,32 @@ public class TestDelOnlyOneClassLive extends XMBaseTest {
}
/**
* 测试删除乐器陪练课
* 测试删除乐器陪练课-课程"zy乐器陪练课1"
*/
@Test
public void testDelOnlyOneClassLive() {
GetOnlyOneCourseData getOnlyOneCourseData=new GetOnlyOneCourseData();
JSONObject onlyOneClassCourse = getOnlyOneCourseData.getOnlyOneCourseList();
JSONObject liveCourse = onlyOneClassCourse.getJSONObject("result").getJSONArray("records").getJSONObject(0);
String liveCourseId = (String) liveCourse.get("liveCourseId");
if (liveCourseId == null){
onlyOneClassCourse = getOnlyOneCourseData.creatOnlyOneCourse();
liveCourseId = (String) onlyOneClassCourse.get("liveCourseId");
JSONObject jsonObject = new JSONObject();
jsonObject.put("liveCourseId","1357508872072433666");
xmAppApi.doRequest(RequestType.JSON, params, jsonObject.toJSONString(), headers);
JSONObject jsonBody = xmAppApi.getBodyInJSON();
Assert.assertEquals("直播课已扣学员课时,不支持删除", jsonBody.getString("message"));
}
System.out.println("liveCourseId ="+liveCourseId);
GetOnlyOneClassLiveListData getOnlyOneClassLiveListData = new GetOnlyOneClassLiveListData();
JSONObject liveList = getOnlyOneClassLiveListData.getOnlyOneClassLiveList() ;
JSONObject liveCourseData = liveList.getJSONObject("result").getJSONArray("records").getJSONObject(0);
String courseName = (String) liveCourseData.get("courseName");
/**
* 测试删除乐器陪练课-删除未成功开课的课程
*/
@Test
public void testDelOnlyOneClassLive1() {
GetOnlyOneCourseData getOnlyOneCourseData=new GetOnlyOneCourseData();
JSONObject onlyOneClassCourse = getOnlyOneCourseData.getOnlyOneCourseList();
String liveCourseId = onlyOneClassCourse.getJSONObject("result").getJSONArray("records").getJSONObject(0).getString("liveCourseId");
String courseName = onlyOneClassCourse.getJSONObject("result").getJSONArray("records").getJSONObject(0).getString("courseName");
System.out.println("courseName ="+courseName);
JSONObject jsonObject = new JSONObject();
......@@ -55,11 +63,13 @@ public class TestDelOnlyOneClassLive extends XMBaseTest {
xmAppApi.doRequest(RequestType.JSON, params, jsonObject.toJSONString(), headers);
JSONObject jsonBody = xmAppApi.getBodyInJSON();
System.out.println("jsonBody ="+jsonBody);
JSONObject liveList1 = getOnlyOneClassLiveListData.getOnlyOneClassLiveList() ;
JSONObject liveCourseData1 = liveList1.getJSONObject("result").getJSONArray("records").getJSONObject(0);
String courseName1 = (String) liveCourseData1.get("courseName");
System.out.println("courseName ="+courseName);
GetOnlyOneCourseData getOnlyOneCourseData1=new GetOnlyOneCourseData();
JSONObject onlyOneClassCourse1 = getOnlyOneCourseData1.getOnlyOneCourseList();
String courseName1 = onlyOneClassCourse1.getJSONObject("result").getJSONArray("records").getJSONObject(0).getString("courseName");
System.out.println("courseName1 ="+courseName1);
Assert.assertEquals("true", jsonBody.getString("success"));
Assert.assertEquals("操作成功!", jsonBody.getString("message"));
......
......@@ -25,7 +25,7 @@ public class TestUpdateStudentVisitCheckedData extends XMBaseTest {
}
/**
* 乐器陪练-学员上课数据,修改扣课时数为0
* 乐器陪练-学员上课数据,学员课时清零之后,修改扣课时数为0
*/
@Test
public void testUpdateStudentVisitCheckedData() {
......@@ -42,14 +42,12 @@ public class TestUpdateStudentVisitCheckedData extends XMBaseTest {
JSONObject jsonBody = xmAppApi.getBodyInJSON();
System.out.println("jsonBody ="+jsonBody );
// Assert.assertNotEquals(0, jsonBody.getJSONArray("result").size());
// Assert.assertEquals("false", jsonBody.getString("success"));
Assert.assertEquals("操作成功!", jsonBody.getString("message"));
}
/**
* 乐器陪练-学员上课数据,修改扣课时数为1
* 乐器陪练-学员上课数据,学员课时清零之后,修改扣课时数为1
*/
@Test
public void testUpdateStudentVisitCheckedData1() {
......@@ -67,8 +65,6 @@ public class TestUpdateStudentVisitCheckedData extends XMBaseTest {
JSONObject jsonBody = xmAppApi.getBodyInJSON();
System.out.println("jsonBody ="+jsonBody );
// Assert.assertNotEquals(0, jsonBody.getJSONArray("result").size());
// Assert.assertEquals("false", jsonBody.getString("success"));
Assert.assertEquals("不能超过剩余课时数", jsonBody.getString("message"));
}
......
package com.live.cases.musicPlay;
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 org.testng.Assert;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
/**
* Created by zhangying on 2020/02/05
*/
public class TestUpdateStudentVisitCheckedData1 extends XMBaseTest {
@BeforeMethod
public void beforeTest() {
xmAppApi.setApiModule(ApiModele.CloudClass_B) // API 所属模块 必传 读取配置文件config.properties配置的api地址
.setApiName("API_updateStudentVisitCheckedData") // API 名称 必传
.setLoginUser("zhangy-b") // http 接口,测试账号 必传
.setTerminal(Terminal.B); // 所属端位(B端,C端,M端等, 必传)
super.beforeTest();
}
/**
* 乐器陪练-学员上课数据,学员课时账户有剩余课时,修改扣课时数为1
*/
@Test
public void testUpdateStudentVisitCheckedData() {
JSONObject jsonObject = new JSONObject();
jsonObject.put("consumeHourClassId","1237292786664587265");
jsonObject.put("consumeHourNum","1");
jsonObject.put("consumeUserId","1235115979394306049");
jsonObject.put("instId","1235115978015883266");
jsonObject.put("liveStudentId","1357508955417194498");
System.out.println("jsonObject ="+jsonObject );
xmAppApi.doRequest(RequestType.JSON, params, jsonObject.toJSONString(), headers);
JSONObject jsonBody = xmAppApi.getBodyInJSON();
System.out.println("jsonBody ="+jsonBody );
Assert.assertEquals("操作成功!", jsonBody.getString("message"));
}
}
......@@ -26,6 +26,7 @@ public class GetOnlyOneCourseData extends XMBaseTest {
bodyMap.put("current", 1);
bodyMap.put("instId", "1235115978015883266");
bodyMap.put("size", 10);
bodyMap.put("courseState","EXPIRED");
String bodydata = JSONObject.toJSONString(bodyMap);
dataApi.doRequest(RequestType.JSON, params, bodydata, dataheadrs);
......
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