Commit 9bd9a213 authored by 张艳玲's avatar 张艳玲

update

parent 8c6caa31
package com.kjj.cases.live;
import com.kjj.config.BasicConfig;
import com.kjj.utils.BaseUtils;
import com.kjj.utils.NetworkUtils;
import static com.kjj.config.BasicConfig.AUTH_KEY;
import static com.kjj.config.BasicConfig.*;
/**
* 管理员授权
* @author zhanghuifeng
* date 2021/2/20-13:46
* @author 喜洋洋
*/
public interface AdminAuthorization {
......@@ -17,9 +12,8 @@ public interface AdminAuthorization {
default void adminAuth(){
// 创建用户 并传到network里
// BasicConfig.AUTH_KEY = BaseUtils.createAuthKey();
network.agentCookies.put("authKey",AUTH_KEY);
System.out.println("用户AUTH_KEY:"+AUTH_KEY);
network.agentCookies.put("authKey",ADMIN_KEY);
System.out.println("用户AUTH_KEY:"+ADMIN_KEY);
}
......@@ -28,9 +22,16 @@ public interface AdminAuthorization {
*/
default void agentAuth(){
// 创建用户 并传到network里
// BasicConfig.AUTH_KEY = BaseUtils.agentAuthKey();
network.agentCookies.put("authKey",AUTH_KEY);
System.out.println("用户AUTH_KEY:"+AUTH_KEY);
/**
* 访客授权
*/
}
default void visitorAuth() {
network.agentCookies.put("authKey", VISITORKEY);
System.out.println("用户AUTH_KEY:" + VISITORKEY);
}
}
package com.kjj.cases.live;
import com.kjj.config.BasicConfig;
import com.kjj.constants.LiveConstants;
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 CloseLive implements AdminAuthorization{
@BeforeClass
public void setUp() {
adminAuth();
}
@Test(description = "结束直播", priority = 1)
public void closeLive() {
Map<String, Object> closeParam = new HashMap<>();
closeParam.put("liveid", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
closeParam.put("cid", 101);
Response closeRes = network.postResponse(closeParam, BasicConfig.ANCHOR_CLOSE);
Object data = closeRes.jsonPath().getJsonObject("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(closeParam, BasicConfig.ANCHOR_CLOSE, "结束直播失败", closeRes.body().asString()));
}
}
......@@ -20,7 +20,7 @@ public class LiveMaterial implements AdminAuthorization {
@BeforeClass
public void setUp() {
adminAuth();
// adminAuth();
BaseUtils.ssoLogin();
}
......
package com.kjj.cases.live;
import com.kjj.config.BasicConfig;
import com.kjj.constants.LiveConstants;
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 OpenLive implements AdminAuthorization {
@BeforeClass
public void setUp() {
adminAuth();
}
@Test(description = "开始直播", priority = 1)
public void 开启直播() {
Map<String, Object> openParam = new HashMap<>();
openParam.put("liveid", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
openParam.put("cid", 101);
Response openRes = network.postResponse(openParam, BasicConfig.ANCHOR_OPEN);
Object data = openRes.jsonPath().getJsonObject("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(openParam, BasicConfig.ANCHOR_OPEN, "开启直播失败", openRes.body().asString()));
}
}
......@@ -4,6 +4,7 @@ import com.kjj.bean.AnswerBean;
import com.kjj.bean.AnswerListBean;
import com.kjj.bean.RewardPkBean;
import com.kjj.config.BasicConfig;
import com.kjj.constants.LiveConstants;
import com.kjj.utils.BaseUtils;
import io.restassured.response.Response;
import org.apache.commons.lang3.time.DateUtils;
......@@ -42,7 +43,10 @@ public class SaveAndUpdate implements AdminAuthorization {
Response response = network.postResponse(saveAndUpdateParam, BasicConfig.MANAGER_SAVEANDUPDATE);
liveID = response.jsonPath().getString("data");
System.out.println(liveID);
LiveConstants.setValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey(),liveID);
Assert.assertNotNull(liveID, network.message(saveAndUpdateParam, BasicConfig.MANAGER_SAVEANDUPDATE, "新增直播失败", response.body().asString()));
LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey());
}
@Test(description = "查询直播配置", priority = 2)
......
......@@ -4,7 +4,7 @@ public class BasicConfig {
public static int apiCount; //接口数量统计
// 是否开启钉钉机器人推送
public static final boolean isPushReport =true; //true
public static final boolean isPushReport =false; //true
// 代理人微信昵称
public static final String WECHAT_NAME = "嘿保险"; //true
......@@ -12,8 +12,14 @@ public class BasicConfig {
// 代理人的openid(固定)
public static final String OPEN_ID = "osi5w5ggFiEXk0tPJH9b0KO_XU08";
// 直播用户 authkey
public static String AUTH_KEY ="LEH7epeHVDJWzhZ6DiexTHnsxqTYbFAJqyMsZZMjY2ByyE2firpRpwm9mdHVU19iqNmyyDTwuCHEYT2URmtEUV7LRD7nU";
//直播管理员(嘿 保险)
public static String ADMIN_KEY="LEH7epeHVDJWzhZ6DiexTHnfZY1XcX7aBeCVXnN9q7y4raLKHyfe7RFy96seJBQ9NSPqtdNg8JjgUTDUcMu8pjJVo6Js6";
// 直播代理人 (艳玲)
public static String AUTH_KEY ="LEH7epeHVDJWzhZ6DiexTHnfZY2NrKorVWS9R85xTeuUZzyc2boHSYWYU56ttSUbcAb9ngEb3LJBB3qZ7a9eCkEoPV5yu";
//直播访客 (嘿 保险)
public static String VISITORKEY ="LEH7epeHVDJWzhZ6DiexTHnfZY2NrKnNHmHY52FxaDfigK3U4NQpLsQrodQUPUXwmumQ1kr3xsfZoGw7cEswYryWfUtMW";
// 基础线代理人 TKU
public static String AGENT_TKU = "T3gM31f18jCFEcfoYxvVk1LsF5T1YkcBNDbUaryi3TgvwatuP6mroJjZ2k7iCHjC9Srujh7k311i3vFuZm";
......@@ -42,10 +48,19 @@ public class BasicConfig {
public static final String MANAGER_HOST = "https://kjj-mng.duibatest.com.cn";
public static final String ANCHOR_HOST ="https://live.duibatest.com.cn";
//手机端地址
public static final String MOBILE_HOST = "https://live.duibatest.com.cn";
// *************** 直播 ***************
// *************** 主播端 ***************
public static final String ANCHOR_OPEN = ANCHOR_HOST + "/conf/live/open";
public static final String ANCHOR_CLOSE = ANCHOR_HOST + "/conf/live/close";
public static final String ANCHOR_ADDQUESTION = ANCHOR_HOST + "/kjy/live/assist/question/addQuestion";
// *************** 直播管理端 ***************
public static final String MANAGER_SAVEANDUPDATE = MANAGER_HOST + "/kjy/manager/live/pre/conf/saveAndUpdate";
public static final String MANAGER_GETCONFDETAIL = MANAGER_HOST + "/kjy/manager/live/conf/getConfDetail";
......@@ -80,6 +95,7 @@ public class BasicConfig {
public static final String MANAGER_SAVEORUPDATE7 = MANAGER_HOST + "/kjy/manager/welfare/pre/conf/saveOrUpdate";
// *************** 代理人 ***************
//代理人列表//
......
package com.kjj.constants;
import lombok.AllArgsConstructor;
import lombok.Getter;
import java.util.HashMap;
import java.util.Map;
public class LiveConstants {
private static final Map<Integer,String> stringMap = new HashMap<>();
public static String getValue(Integer key){
return stringMap.get(key) ;
}
public static void setValue(Integer key, String value){
stringMap.put(key, value);
}
@Getter
@AllArgsConstructor
public enum StringKeyEnum{
LIVE_ID(1,"直播ID的key"),
;
private Integer key;
private String desc;
}
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="直播" verbose="1" thread-count="3">
<test preserve-order="true" name="创建直播">
<test preserve-order="true" name="直播素材">
<classes>
<class name="com.kjj.cases.live.LiveMaterial"/>
</classes>
</test>
<test preserve-order="true" name="创建直播">
<classes>
<class name="com.kjj.cases.live.SaveAndUpdate"/>
</classes>
</test>
<test preserve-order="true" name="代理人首页">
<classes>
<class name="com.kjj.cases.live.SaveAndUpdate"/>
<class name="com.kjj.cases.live.Procurator"/>
</classes>
</test>
<test preserve-order="true" name="代理人首页">
<test preserve-order="true" name="助播-开启直播">
<classes>
<class name="com.kjj.cases.live.Procurator"/>
<class name="com.kjj.cases.live.OpenLive"/>
</classes>
</test>
<test preserve-order="true" name="直播素材">
<test preserve-order="true" name="助播-结束直播">
<classes>
<class name="com.kjj.cases.live.LiveMaterial"/>
<class name="com.kjj.cases.live.CloseLive"/>
</classes>
</test>
</suite>
......@@ -2,8 +2,10 @@
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="客集集" verbose="1" thread-count="3">
<suite-files>
<suite-file path="wechatTestNG.xml"></suite-file>
<suite-file path="liveTestNG.xml"></suite-file>
<!-- <suite-file path="wechatTestNG.xml"></suite-file>-->
</suite-files>
<!-- 监听器-->
<listeners>
......
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