Commit a8b48fde authored by xiamengchen's avatar xiamengchen

Merge branch 'master' into feature/20210907-xmc

# Conflicts:
#	src/test/liveTestNG.xml
parents 8b758343 de46e8bf
package com.kjj.cases.live.liveConfig;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.kjj.bean.answer.AddReward;
import com.kjj.bean.answer.AddWelfareConf;
import com.kjj.bean.answer.RewardList;
import com.kjj.bean.issue.Dialogue;
import com.kjj.bean.lottery.ConfIdList;
import com.kjj.bean.manager.*;
import com.kjj.cases.admin.Authorization;
import com.kjj.config.BasicConfig;
import com.kjj.constants.LiveConstants;
import com.kjj.utils.IdMakeUtil;
import com.kjj.utils.JsonUtil;
import com.kjj.utils.ThreadSleepUtils;
import io.restassured.response.Response;
import org.apache.commons.lang3.RandomUtils;
import org.apache.commons.lang3.time.DateUtils;
import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import java.util.*;
import static com.kjj.utils.BaseUtils.ssoLogin;
public class SimpleLiveConfig implements Authorization {
public String liveID;
public String EncodeLiveID;
public long welfareConfId;
private Integer taskId;
public List<RedList> redId;
@BeforeClass
public void setUp() {
ssoLogin(); }
/**
* 创建直播
*/
@Test(description = "创建直播", priority = 1)
public void 创建直播() {
Map<String, Object> Params = new HashMap<>();
Params.put("posterUrl", "https://streamimg.kjjcrm.com/kjy/image/20210201/e36cb31828e14a3ebb9d01e6be79ad66.jpg");
Params.put("videoUrl", "http://streamimg.kjjcrm.com/kjy/image/20210201/1612171657348.mp4");
Params.put("welfareUrl", "https://streamimg.kjjcrm.com/kjy/image/20210201/62c25dcb3b9b4d269a74894e4255a193.jpg");
Params.put("coverUrl", "https://streamimg.kjjcrm.com/kjy/image/20210201/d4093b24aaca49da8f0e3e276721feea.jpg");
Params.put("mpShareUrl", "https://streamimg.kjjcrm.com/kjy/image/20210201/182f3659e39b4ea6898af781cc6344a1.jpg");
Params.put("title", "直播测试" + RandomUtils.nextInt(1, 100));
Params.put("mpShareTitle", "自动化直播");
Params.put("companyId", 101);
Params.put("agentInviteAuthType", 1);
Params.put("agentInviteAuthLimitNum", 1);
long noticeTime = DateUtils.addHours(new Date(), 2).getTime();
long broadcastTime = DateUtils.addHours(new Date(), 5).getTime();
Params.put("noticeTime", noticeTime);
Params.put("broadcastTime", broadcastTime);
Params.put("shareContent", "自动化直播 #{shortLink}");
Params.put("shelfStatus", 2);
Params.put("secondPoster", "https://streamimg.kjjcrm.com/kjy/image/20210201/cc999ebde48e49f99ac3f0d93480453f.jpg");
Params.put("regionType",2);
Params.put("preAwardUrl","https://yun.dui88.com/kjy/image/20210629/1624949155842.png");
Params.put("preWindowUrl","https://yun.dui88.com/kjy/image/20210629/1624949098093.png");
Params.put("distributionType", 0);
Params.put("existSeriesPoster", 0);
List<ProvinceCityCodeList> provinceCityCode = new ArrayList<>();
ProvinceCityCodeList save = new ProvinceCityCodeList();
save.setProvinceCode(110000);
save.setCityCode(null);
provinceCityCode.add(save);
ProvinceCityCodeList save1 = new ProvinceCityCodeList();
save1.setProvinceCode(420000);
save1.setCityCode(420900);
provinceCityCode.add(save1);
ProvinceCityCodeList save2 = new ProvinceCityCodeList();
save2.setProvinceCode(330000);
save2.setCityCode(330100);
provinceCityCode.add(save2);
Params.put("provinceCityCodeList", provinceCityCode);
Response response = network.postResponse(Params, BasicConfig.MANAGER_saveAndUpdate_0);
liveID = response.jsonPath().getString("data");
EncodeLiveID = IdMakeUtil.encodingId(Long.valueOf(liveID));
System.out.println(liveID);
LiveConstants.setValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey(), liveID);
LiveConstants.setValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey(), EncodeLiveID);
Assert.assertNotNull(liveID, network.message(Params, BasicConfig.MANAGER_saveAndUpdate_0, "新增直播失败", response.body().asString()));
LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey());
}
/**
* 基础配置
*/
@Test(description = "查询直播配置", priority = 2)
public void 查询直播配置() {
Map<String, Object> params = new HashMap<>();
params.put("liveId", liveID);
Response response = network.getResponse(params, BasicConfig.MANAGER_getConfDetail);
Object data = response.jsonPath().getJsonObject("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(params, BasicConfig.MANAGER_getConfDetail, "查询配置失败", response.body().asString()));
}
@Test(description = "单场红包配置", priority = 3)
public void 单场红包配置() {
//单场红包限额
Map<String, Object> Params = new HashMap<>();
Params.put("liveId", liveID);
Params.put("maxAmount", 100000);
Response response = network.postResponse(Params, BasicConfig.MANAGER_MaxAmount);
boolean data = response.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(Params, BasicConfig.MANAGER_MaxAmount, "单场红包限额配置失败", response.body().asString()));
}
@Test(description = "展示红包金额", priority = 4)
public void 展示红包金额() {
//展示红包金额
Map<String, Object> Params = new HashMap<>();
Params.put("liveId", liveID);
Params.put("showAmount", 100000);
Response response = network.postResponse(Params, BasicConfig.MANAGER_ShowAmount);
boolean data = response.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(Params, BasicConfig.MANAGER_ShowAmount, "展示红包配置失败", response.body().asString()));
}
@Test(description = "直播资料", priority = 5)
public void 直播资料() {
Map<String, Object> Params = new HashMap<>();
Params.put("liveId", liveID);
List<Material> ids = new ArrayList<>();
ids.add(new Material(355L,0));
ids.add(new Material(356L,0));
ids.add(new Material(357L,0));
ids.add(new Material(358L,0));
ids.add(new Material(359L,0));
ids.add(new Material(960L,0));
ids.add(new Material(3384L,0));
Params.put("resourceList", ids);
Response response = network.postResponse(Params, BasicConfig.MANAGER_saveAndUpdate_8);
boolean data = response.jsonPath().getBoolean("data");
System.out.println(response.body().asString());
Assert.assertTrue(data, network.message(Params, BasicConfig.MANAGER_saveAndUpdate_8, "产品资料配置失败", response.body().asString()));
}
}
...@@ -329,10 +329,4 @@ public class DesignatedWinner implements Authorization { ...@@ -329,10 +329,4 @@ public class DesignatedWinner implements Authorization {
Assert.assertNotNull(data, network.message(AwardConfParam, BasicConfig.MOBILE_agentSpecifyAwardConf, "代理人指定中奖配置查询失败", AwardConfRes.body().asString())); Assert.assertNotNull(data, network.message(AwardConfParam, BasicConfig.MOBILE_agentSpecifyAwardConf, "代理人指定中奖配置查询失败", AwardConfRes.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