Commit 13fe04ee authored by 张艳玲's avatar 张艳玲

奖品签收

parent d32099d9
package com.kjj.bean.manager;
import lombok.Data;
@Data
public class QuesReward {
private long id;
}
package com.kjj.bean.manager;
import lombok.Data;
import java.util.List;
@Data
public class TeamAssignmentList {
private List<TeamAssignmentList.team_List> list;
@Data
public static class team_List {
private long id;
}
}
package com.kjj.cases.live.manager.QuesReward;
import com.alibaba.fastjson.JSON;
import com.kjj.bean.lottery.ConfidList;
import com.kjj.bean.manager.QuesReward;
import com.kjj.bean.manager.TeamAssignmentList;
import com.kjj.cases.live.admin.AdminAuthorization;
import com.kjj.config.BasicConfig;
import com.kjj.constants.LiveConstants;
import com.kjj.utils.BaseUtils;
import com.kjj.utils.JsonUtil;
import io.restassured.response.Response;
import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class TeamAssignment implements AdminAuthorization {
@BeforeClass
public void setUp() {
BaseUtils.ssoLogin();
}
public List<QuesReward> ListConfid;
public List<TeamAssignmentList.team_List> teamID;
@Test(description = "获取有奖答题列表信息", priority = 1)
public void 获取有奖答题列表信息() {
Map<String, Object> getConfParam = new HashMap<>();
getConfParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
// getConfParam.put("liveId", 2960);
Response response = network.getResponse(getConfParam, BasicConfig.MANAGER_reward);
List<QuesReward> list = JsonUtil.parseResponseToListBean(response, QuesReward.class);
System.out.println(list);
this.ListConfid = list;
Assert.assertNotNull(list, network.message(getConfParam, BasicConfig.MANAGER_reward, "获取有奖答题列表信息失败", response.body().asString()));
}
@Test(description = "获取答题按团队分配的团队列表", priority = 2)
public void 获取答题按团队分配的团队列表() {
Map<String, Object> TeamParam = new HashMap<>();
TeamParam.put("confId", this.ListConfid.get(1).getId());
TeamParam.put("pageIndex",1);
TeamParam.put("pageSize",50);
Response response = network.getResponse(TeamParam, BasicConfig.MANAGER_TeamAssignmentList);
Object data = response.jsonPath().getJsonObject("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(TeamParam, BasicConfig.MANAGER_TeamAssignmentList, "获取有奖答题列表信息失败", response.body().asString()));
}
@Test(description = "添加团队", priority = 3)
public void 添加团队() {
Map<String, Object> addTeamParam = new HashMap<>();
addTeamParam.put("confId", this.ListConfid.get(1).getId());
addTeamParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
addTeamParam.put("teamIds", Arrays.asList(3837,3324,3817));
Response response = network.postResponse(addTeamParam, BasicConfig.MANAGER_addTeam);
Object failSize = response.jsonPath().getJsonObject("data.failSize");
System.out.println(failSize);
Assert.assertEquals(failSize,0, network.message(addTeamParam, BasicConfig.MANAGER_addTeam, "添加团队失败", response.body().asString()));
}
@Test(description = "获取答题已分配的团队列表", priority = 4)
public void 获取答题已分配的团队列表() {
Map<String, Object> TeamParam = new HashMap<>();
TeamParam.put("confId", this.ListConfid.get(1).getId());
TeamParam.put("pageIndex",1);
TeamParam.put("pageSize",50);
Response response = network.getResponse(TeamParam, BasicConfig.MANAGER_TeamAssignmentList);
List<TeamAssignmentList.team_List> list = JSON.parseArray(JSON.toJSONString(response.jsonPath().get("data.list")),TeamAssignmentList.team_List.class);
System.out.println(list);
this.teamID = list;
Assert.assertNotNull(list, network.message(TeamParam, BasicConfig.MANAGER_TeamAssignmentList, "获取有奖答题列表信息失败", response.body().asString()));
}
@Test(description = "单个团队删除", priority = 5)
public void 单个团队删除() {
Map<String, Object> TeamParam = new HashMap<>();
TeamParam.put("confId", this.ListConfid.get(1).getId());
TeamParam.put("id",this.teamID.get(0).getId());
Response response = network.postResponse(TeamParam, BasicConfig.MANAGER_delTeam);
boolean data = response.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(TeamParam, BasicConfig.MANAGER_delTeam, "单个团队删除", response.body().asString()));
}
@Test(description = "一键清空团队", priority = 6)
public void 一键清空团队() {
Map<String, Object> TeamParam = new HashMap<>();
TeamParam.put("confId", this.ListConfid.get(1).getId());
Response response = network.postResponse(TeamParam, BasicConfig.MANAGER_deleteAll);
boolean data = response.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(TeamParam, BasicConfig.MANAGER_deleteAll, "一键清空团队失败", response.body().asString()));
}
@Test(description = "添加指定中奖团队", priority = 7)
public void 添加指定中奖团队() {
Map<String, Object> addTeamParam = new HashMap<>();
addTeamParam.put("confId", this.ListConfid.get(1).getId());
addTeamParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
addTeamParam.put("teamIds", Arrays.asList(3817));
Response response = network.postResponse(addTeamParam, BasicConfig.MANAGER_addTeam);
Object failSize = response.jsonPath().getJsonObject("data.failSize");
System.out.println(failSize);
Assert.assertEquals(failSize,0, network.message(addTeamParam, BasicConfig.MANAGER_addTeam, "添加指定中奖团队失败", response.body().asString()));
}
@Test(description = "开启团队配置开关", priority = 8)
public void 开启团队配置开关() {
Map<String, Object> addTeamParam = new HashMap<>();
addTeamParam.put("confId", this.ListConfid.get(1).getId());
Response response = network.postResponse(addTeamParam, BasicConfig.MANAGER_updateTeam);
boolean data = response.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(addTeamParam, BasicConfig.MANAGER_updateTeam, "开启团队配置开关失败", response.body().asString()));
}
}
package com.kjj.cases.live.manager; package com.kjj.cases.live.manager.QuesReward;
import com.kjj.cases.live.admin.AdminAuthorization; import com.kjj.cases.live.admin.AdminAuthorization;
import com.kjj.config.BasicConfig; import com.kjj.config.BasicConfig;
import com.kjj.constants.LiveConstants;
import com.kjj.utils.BaseUtils; import com.kjj.utils.BaseUtils;
import io.restassured.response.Response; import io.restassured.response.Response;
import org.testng.Assert; import org.testng.Assert;
...@@ -11,7 +12,7 @@ import org.testng.annotations.Test; ...@@ -11,7 +12,7 @@ import org.testng.annotations.Test;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
public class QuesReward implements AdminAuthorization { public class Unlimited implements AdminAuthorization {
@BeforeClass @BeforeClass
public void setUp() { public void setUp() {
...@@ -21,8 +22,8 @@ public class QuesReward implements AdminAuthorization { ...@@ -21,8 +22,8 @@ public class QuesReward implements AdminAuthorization {
@Test(description = "获取有奖答题列表信息", priority = 1) @Test(description = "获取有奖答题列表信息", priority = 1)
public void 获取有奖答题列表信息() { public void 获取有奖答题列表信息() {
Map<String, Object> getConfParam = new HashMap<>(); Map<String, Object> getConfParam = new HashMap<>();
// getConfParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey())); getConfParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
getConfParam.put("liveId", 2960); // getConfParam.put("liveId", 2960);
Response response = network.getResponse(getConfParam, BasicConfig.MANAGER_reward); Response response = network.getResponse(getConfParam, BasicConfig.MANAGER_reward);
Object data = response.jsonPath().getJsonObject("data"); Object data = response.jsonPath().getJsonObject("data");
System.out.println(data); System.out.println(data);
...@@ -30,19 +31,24 @@ public class QuesReward implements AdminAuthorization { ...@@ -30,19 +31,24 @@ public class QuesReward implements AdminAuthorization {
} }
@Test(description = "获取本场答题有奖规则", priority = 2) @Test(description = "本场答题无限制中奖规则", priority = 2)
public void 获取本场答题有奖规则() { public void 本场答题无限制中奖规则() {
Map<String, Object> getConfParam = new HashMap<>(); Map<String, Object> getConfParam = new HashMap<>();
// getConfParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey())); getConfParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
getConfParam.put("liveId", 2960); // getConfParam.put("liveId", 2960);
Response response = network.getResponse(getConfParam, BasicConfig.MANAGER_getQuestionPrizesRule); Response response = network.getResponse(getConfParam, BasicConfig.MANAGER_getQuestionPrizesRule);
Object data = response.jsonPath().getJsonObject("data"); Object redPacketRuleType = response.jsonPath().getJsonObject("data.redPacketRuleType");
System.out.println(data); System.out.println(redPacketRuleType);
Assert.assertNotNull(data, network.message(getConfParam, BasicConfig.MANAGER_getQuestionPrizesRule, "获取本场答题有奖规则失败", response.body().asString())); Assert.assertEquals(redPacketRuleType,1, network.message(getConfParam, BasicConfig.MANAGER_getQuestionPrizesRule, "答题有奖红包规则无限制", response.body().asString()));
Object welfareRuleType = response.jsonPath().getJsonObject("data.welfareRuleType");
System.out.println(welfareRuleType);
Assert.assertEquals(welfareRuleType,1, network.message(getConfParam, BasicConfig.MANAGER_getQuestionPrizesRule, "答题有奖实物规则无限制", response.body().asString()));
} }
} }
package com.kjj.cases.live.manager.QuesReward;
import com.kjj.cases.live.admin.AdminAuthorization;
import com.kjj.config.BasicConfig;
import com.kjj.constants.LiveConstants;
import com.kjj.utils.BaseUtils;
import io.restassured.response.Response;
import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import java.util.HashMap;
import java.util.Map;
public class limited implements AdminAuthorization {
@BeforeClass
public void setUp() {
BaseUtils.ssoLogin();
}
@Test(description = "修改本场答题规则仅一次中奖", priority = 1)
public void 修改本场答题规则仅一次中奖() {
Map<String, Object> updateParam = new HashMap<>();
updateParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
// updateParam.put("liveId", 2960);
updateParam.put("redPacketRuleType", 2);
updateParam.put("welfareRuleType", 2);
Response response = network.postResponse(updateParam, BasicConfig.MANAGER_updateQuestionPrizesRule);
boolean data = response.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(updateParam, BasicConfig.MANAGER_updateQuestionPrizesRule, "答题有奖红包规则无限制", response.body().asString()));
}
@Test(description = "答题有奖限制中奖1次", priority = 2)
public void 答题有奖限制中奖1() {
Map<String, Object> getConfParam = new HashMap<>();
getConfParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
// getConfParam.put("liveId", 2960);
Response response = network.getResponse(getConfParam, BasicConfig.MANAGER_getQuestionPrizesRule);
Object redPacketRuleType = response.jsonPath().getJsonObject("data.redPacketRuleType");
System.out.println(redPacketRuleType);
Assert.assertEquals(redPacketRuleType,2, network.message(getConfParam, BasicConfig.MANAGER_getQuestionPrizesRule, "答题有奖红包限制1次", response.body().asString()));
Object welfareRuleType = response.jsonPath().getJsonObject("data.welfareRuleType");
System.out.println(welfareRuleType);
Assert.assertEquals(welfareRuleType,2, network.message(getConfParam, BasicConfig.MANAGER_getQuestionPrizesRule, "答题有奖红包限制1次", response.body().asString()));
}
}
...@@ -298,7 +298,12 @@ public class BasicConfig { ...@@ -298,7 +298,12 @@ public class BasicConfig {
//***************有奖答题***************** //***************有奖答题*****************
public static final String MANAGER_reward = MANAGER_HOST+ "/kjy/manager/live/ques/reward/list"; public static final String MANAGER_reward = MANAGER_HOST+ "/kjy/manager/live/ques/reward/list";
public static final String MANAGER_getQuestionPrizesRule = MANAGER_HOST+ "/kjy/manager/live/ques/reward/getQuestionPrizesRule"; public static final String MANAGER_getQuestionPrizesRule = MANAGER_HOST+ "/kjy/manager/live/ques/reward/getQuestionPrizesRule";
public static final String MANAGER_updateQuestionPrizesRule = MANAGER_HOST+ "/kjy/manager/live/ques/reward/updateQuestionPrizesRule";
public static final String MANAGER_TeamAssignmentList = MANAGER_HOST+ "/kjy/manager/live/ques/reward/getTeamAssignmentList";
public static final String MANAGER_addTeam = MANAGER_HOST+ "/kjy/manager/live/ques/reward/addTeamAssignmentList";
public static final String MANAGER_delTeam = MANAGER_HOST+ "/kjy/manager/live/ques/reward/deleteTeamAssignment";
public static final String MANAGER_deleteAll = MANAGER_HOST+ "/kjy/manager/live/ques/reward/deleteAllTeamAssignment";
public static final String MANAGER_updateTeam = MANAGER_HOST+ "/kjy/manager/live/ques/reward/updateTeamAssignmentType";
// *************** 素材ID *************** // *************** 素材ID ***************
public static final String ARTICLE_CONTENTID = "Kj21NjM4NDc"; public static final String ARTICLE_CONTENTID = "Kj21NjM4NDc";
......
...@@ -19,12 +19,24 @@ ...@@ -19,12 +19,24 @@
</classes> </classes>
</test> </test>
<test preserve-order="true" name="有奖答题配置"> <test preserve-order="true" name="有奖答题无限制配置">
<classes> <classes>
<class name="com.kjj.cases.live.manager.QuesReward"/> <class name="com.kjj.cases.live.manager.QuesReward.Unlimited"/>
</classes> </classes>
</test> </test>
<test preserve-order="true" name="有奖答题团队配置">
<classes>
<class name="com.kjj.cases.live.manager.QuesReward.TeamAssignment"/>
</classes>
</test>
<test preserve-order="true" name="有奖答题限制1次中奖">
<classes>
<class name="com.kjj.cases.live.manager.QuesReward.limited"/>
</classes>
</test>
<test preserve-order="true" name="中奖规则配置"> <test preserve-order="true" name="中奖规则配置">
<classes> <classes>
<class name="com.kjj.cases.live.manager.LotteryRule"/> <class name="com.kjj.cases.live.manager.LotteryRule"/>
......
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