Commit b1f0b841 authored by xiamengchen's avatar xiamengchen

Merge branch 'master' into feature/20210805-xmc

parents efc92989 29455e09
This diff is collapsed.
......@@ -8,6 +8,7 @@ import com.kjj.cases.admin.Authorization;
import com.kjj.config.BasicConfig;
import com.kjj.constants.LiveConstants;
import com.kjj.utils.JsonUtil;
import com.kjj.utils.ThreadSleepUtils;
import io.restassured.response.Response;
import org.apache.commons.lang3.RandomUtils;
import org.testng.Assert;
......@@ -22,8 +23,6 @@ import static com.kjj.config.BasicConfig.*;
public class Agent implements Authorization {
@BeforeClass
public void setUp() { agentAuth(); }
public String id;
public String videoId;
public String videoTitle;
......@@ -35,14 +34,15 @@ public class Agent implements Authorization {
public String teamName;
public String sellerName;
@BeforeClass
public void setUp() { agentAuth(); }
@Test(description="获取用户信息判断是否是代理人",priority = 1)
public void 获取用户信息判断是否是代理人() {
Map<String, Object> params = new HashMap<String, Object>();
Response response = network.getResponse(params, BasicConfig.MOBILE_userInfo1);
Object data = response.jsonPath().getJsonObject("data");
System.out.println(data);
System.out.println(response.body().asString());
Object jobNumber = response.jsonPath().getJsonObject("data.jobNumber");
System.out.println(jobNumber);
Assert.assertNotNull(jobNumber, network.message(params, BasicConfig.MOBILE_userInfo1, "用户非代理人", response.body().asString()));
}
......@@ -52,8 +52,8 @@ public class Agent implements Authorization {
Map<String, Object> params = new HashMap<String, Object>();
params.put("appid","wx4d7276f866bd24c8");
Response response = network.getResponse(params, BasicConfig.MOBILE_isForbidden);
System.out.println(response.body().asString());
Boolean data =response.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertFalse(data, network.message(params, BasicConfig.MOBILE_isForbidden, "禁止分享", response.body().asString()));
}
......@@ -441,6 +441,24 @@ public class Agent implements Authorization {
}
@Test(description="获取小程序短链",priority = 28)
public void 获取小程序短链() {
Map<String, Object> params = new HashMap<String, Object>();
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
params.put("shortType",2);
Response response =null;
for (int i = 0; i < 10; i++) {
response = network.postResponse(params,MOBILE_getShortUrl);
String data = response.jsonPath().getString("data");
System.out.println(data);
if (data!=null) return;
}
Assert.fail(network.message(params, BasicConfig.MOBILE_getShortUrl, "获取小程序短链失败", response.body().asString()));
}
}
......
......@@ -17,11 +17,11 @@ import java.util.List;
import java.util.Map;
public class LiveLater implements Authorization {
public String pageSize;
public List<LiveUserList> liveUserId;
@BeforeClass
public void setUp() { agentAuth(); }
public String pageSize;
public List<LiveUserList> liveUserId;
//获取回收成功案例
......
package com.kjj.cases.live.agent;
import com.kjj.cases.admin.Authorization;
import com.kjj.config.BasicConfig;
import com.kjj.constants.LiveConstants;
import com.kjj.utils.ThreadSleepUtils;
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 Potential implements Authorization {
public String bizConfId;
@BeforeClass
public void setUp() { visitorAuth(); }
@Test(description = "直播间名片", priority =1)
public void 直播间名片() {
Map<String, Object> Params = new HashMap<>();
Params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response response = network.getResponse(Params, BasicConfig.ANCHOR_card);
System.out.println(response.body().asString());
Object data = response.jsonPath().getJsonObject("data");
Assert.assertNotNull(data, network.message(Params, BasicConfig.ANCHOR_card, "未获取直播间名片信息", response.body().asString()));
}
@Test(description = "获取推送问题咨询", priority =2)
public void 获取推送问题() {
Map<String, Object> Params = new HashMap<>();
Params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response response = network.getResponse(Params, BasicConfig.ANCHOR_questions);
System.out.println(response.body().asString());
bizConfId=response.jsonPath().getString("data[0].id");
Assert.assertNotNull(bizConfId, network.message(Params, BasicConfig.ANCHOR_questions, "为获取到问题ID", response.body().asString()));
}
@Test(description = "潜在客户提交咨询信息", priority =3)
public void 潜在客户提交信息() {
Map<String, Object> Params = new HashMap<>();
Params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Params.put("bizConfId",bizConfId);
Params.put("chanceType",1);
Response response = network.postResponse(Params, BasicConfig.ANCHOR_submit);
System.out.println(response.body().asString());
boolean data=response.jsonPath().getBoolean("data");
Assert.assertTrue(data, network.message(Params, BasicConfig.ANCHOR_submit, "客户提交信息失败", response.body().asString()));
}
@Test(description = "潜在客户标记同意", priority =4)
public void 潜在客户标记同意() {
Map<String, Object> Params = new HashMap<>();
Params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Params.put("bizConfId",bizConfId);
Params.put("chanceType",1);
Params.put("agreeFlag",true);
Response response = network.postResponse(Params, BasicConfig.ANCHOR_agree);
System.out.println(response.body().asString());
boolean data=response.jsonPath().getBoolean("data");
Assert.assertTrue(data, network.message(Params, BasicConfig.ANCHOR_agree, "客户未标记同意", response.body().asString()));
}
@Test(description = "获取访客已提交的问题", priority =5)
public void 获取访客已提交的问题() {
Map<String, Object> Params = new HashMap<>();
Params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response response = network.getResponse(Params, BasicConfig.ANCHOR_questionSubmitted);
System.out.println(response.body().asString());
String id=response.jsonPath().getString("data.id");
Assert.assertEquals(id,bizConfId, network.message(Params, BasicConfig.ANCHOR_questionSubmitted, "访客已提交的问题为null", response.body().asString()));
}
@Test(description = "获取访客跟进机会同意状态", priority =6)
public void 获取访客跟进机会同意状态() {
ThreadSleepUtils.sleep(1000);
Map<String, Object> Params = new HashMap<>();
Params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Params.put("chanceType",1);
Params.put("bizConfId",bizConfId);
Response response = network.getResponse(Params, BasicConfig.ANCHOR_agreeStatus);
System.out.println(response.body().asString());
boolean data=response.jsonPath().getBoolean("data");
Assert.assertTrue(data, network.message(Params, BasicConfig.ANCHOR_agreeStatus, "客跟进机会同意状态为false", response.body().asString()));
}
@Test(description = "获取对话模版oss地址", priority =7)
public void 获取对话模版oss地址() {
Response response = network.getResponse(BasicConfig.ANCHOR_ossDialogue);
System.out.println(response.body().asString());
boolean data=response.jsonPath().getBoolean("data");
Assert.assertNotNull(data, network.message(BasicConfig.ANCHOR_ossDialogue, "未获取到对话模版oss地址", response.body().asString()));
}
}
......@@ -19,7 +19,6 @@ import java.util.Map;
public class LiveVisitors implements Authorization
{
public String confId_imageText;
public String confId_form;
public String confId_link;
......@@ -28,8 +27,6 @@ public class LiveVisitors implements Authorization
public String id;
public List<ResourcePushList>PushList;
/*助播端端权益列表*/
@Test(description = "助播端权益列表", priority = 1)
public void 助播端权益列表()
......@@ -251,9 +248,6 @@ public class LiveVisitors implements Authorization
Assert.assertTrue(data,network.message(params,BasicConfig.MOBILE_ResourceTestSubmit,"提交秒薪测试失败",response.body().asString()));
}
//********************代理人*************//
//********************代理人*************//
//********************代理人*************//
/*代理人端权益列表查询*/
@Test(description = "代理人端权益列表查询", priority = 14)
public void 代理人端权益列表查询()
......@@ -418,6 +412,7 @@ public class LiveVisitors implements Authorization
public void 获取推送列表()
{
adminAuth();
ThreadSleepUtils.sleep(1000);
Map<String, Object> params = new HashMap<>();
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
params.put("confId", this.PushList.get(5).getConfId());
......@@ -454,9 +449,37 @@ public class LiveVisitors implements Authorization
Assert.assertTrue(data, network.message(params, BasicConfig.MOBILE_pasterOff, "贴片下架失败", response.body().asString()));
}
/**
* 资料-我要咨询
*/
@Test(description = "资料咨询时客户标记同意", priority =28)
public void 资料咨询时客户标记同意() {
Map<String, Object> Params = new HashMap<>();
Params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Params.put("bizConfId",confId_link);
Params.put("chanceType",2);
Params.put("agreeFlag",true);
Response response = network.postResponse(Params, BasicConfig.ANCHOR_agree);
System.out.println(response.body().asString());
boolean data=response.jsonPath().getBoolean("data");
Assert.assertTrue(data, network.message(Params, BasicConfig.ANCHOR_agree, "客户未标记同意", response.body().asString()));
}
@Test(description = "获取访客跟进机会同意状态", priority =29)
public void 获取访客跟进机会同意状态() {
Map<String, Object> Params = new HashMap<>();
Params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Params.put("chanceType",2);
Params.put("bizConfId",confId_link);
Response response = network.getResponse(Params, BasicConfig.ANCHOR_agreeStatus);
System.out.println(response.body().asString());
boolean data=response.jsonPath().getBoolean("data");
Assert.assertTrue(data, network.message(Params, BasicConfig.ANCHOR_agreeStatus, "客跟进机会同意状态为false", response.body().asString()));
}
}
......@@ -164,7 +164,7 @@ public class FlipCard implements Authorization {
params.put("shareType",2);
Response signRes = network.getResponse(params, BasicConfig.MOBILE_sign);
String data = signRes.jsonPath().getString("data");
this.shareSign = data;
shareSign = data;
System.out.println(shareSign);
Assert.assertNotNull(shareSign, network.message(params, BasicConfig.MOBILE_sign, "分享失败", signRes.body().asString()));
......
......@@ -49,7 +49,7 @@ public class SaveLive implements Authorization {
long broadcastTime = DateUtils.addHours(new Date(), 5).getTime();
Params.put("noticeTime", noticeTime);
Params.put("broadcastTime", broadcastTime);
Params.put("shareContent", "自动化直播");
Params.put("shareContent", "自动化直播 #{shortLink}");
Params.put("shelfStatus", 2);
Params.put("secondPoster", "https://streamimg.kjjcrm.com/kjy/image/20210201/cc999ebde48e49f99ac3f0d93480453f.jpg");
Params.put("regionType",2);
......
......@@ -97,6 +97,15 @@ public class BasicConfig {
public static final String ANCHOR_getConfDetail = MOBILE_HOST + "/conf/pre/getConfDetail";
public static final String ANCHOR_CLOSE = MOBILE_HOST + "/conf/live/close";
// *************** 准客户 ***************
public static final String ANCHOR_card = MOBILE_HOST + "/clue/agent/card";
public static final String ANCHOR_questions = MOBILE_HOST + "/kjy/live/agent/potential/questions";
public static final String ANCHOR_submit = MOBILE_HOST + "/kjy/live/agent/potential/submit";
public static final String ANCHOR_agree = MOBILE_HOST + "/kjy/live/agent/potential/agree";
public static final String ANCHOR_questionSubmitted = MOBILE_HOST + "/kjy/live/agent/potential/questionSubmitted";
public static final String ANCHOR_agreeStatus = MOBILE_HOST + "/kjy/live/agent/potential/agreeStatus";
public static final String ANCHOR_ossDialogue = MOBILE_HOST + "/kjy/live/agent/potential/ossDialogue";
// *************** 预告页配置 ***************
public static final String MANAGER_preViewWelfareList = MANAGER_HOST + "/kjy/manager/preView/conf/welfareList";
public static final String MANAGER_confMainWelfare = MANAGER_HOST + "/kjy/manager/preView/conf/confMainWelfare";
......@@ -360,15 +369,17 @@ public class BasicConfig {
//客户管理
public static final String MOBILE_potentialCount = MOBILE_HOST + "/kjy/live/agent/customer/potentialCount";
public static final String MOBILE_customerList = MOBILE_HOST + "/kjy/live/agent/customer/list";
public static final String MOBILE_count = MOBILE_HOST + "/kjy/live/agent/customer/count";
public static final String MOBILE_lastLiveList = MOBILE_HOST + "/kjy/live/agent/customer/lastLiveList";
public static final String MOBILE_basicInfo = MOBILE_HOST + "/kjy/live/agent/customer/basicInfo";
public static final String MOBILE_clueInfo = MOBILE_HOST + "/kjy/live/agent/customer/clueInfo";
public static final String MOBILE_customerUpdate = MOBILE_HOST + "/kjy/live/agent/customer/update";
public static final String MOBILE_customerDetail = MOBILE_HOST + "/kjy/live/agent/customer/detail";
public static final String MOBILE_liveInfo = MOBILE_HOST + "/kjy/live/agent/customer/liveInfo";
// public static final String MOBILE_updateRemarkName = MOBILE_HOST + "/kjy/live/agent/customer/updateRemarkName";
public static final String MOBILE_followChanceList = MOBILE_HOST + "/kjy/live/agent/customer/followChanceList";
public static final String MOBILE_customerGetReplyAdvice = MOBILE_HOST + "/kjy/live/agent/customer/getReplyAdvice";
public static final String MOBILE_followChanceDetail = MOBILE_HOST + "/kjy/live/agent/customer/followChanceDetail";
// *************** 代理人 ***************
public static final String MOBILE_recycleSuccessCase = MOBILE_HOST + "/kjy/live/agent/clue/recycleSuccessCase";
public static final String MOBILE_providerInfo = MOBILE_HOST + "/kjy/live/agent/clue/providerInfo";
......@@ -459,7 +470,7 @@ public class BasicConfig {
public static final String MOBILE_pasterOn = MOBILE_HOST + "/conf/live/push/pasterOn";
public static final String MOBILE_pasterInfo = MOBILE_HOST + "/clue/paster/info";
public static final String MOBILE_pasterOff = MOBILE_HOST + "/conf/live/push/pasterOff";
public static final String MOBILE_getShortUrl = MOBILE_HOST + "/kjy/live/share/short/getShortUrl";
//投票
......
package com.kjj.utils;
package com.kjj.sql;
import java.sql.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.alibaba.fastjson.JSON;
public class MysqlUtils {
private static final String PREFIX = "dbseccode";
private static final String secret = "CNxgrtFG2nYQUfu";
import java.sql.*;
import java.util.*;
private static Map<String, MysqlUtils> pool=new HashMap<>();
public class KjyUserDB {
private static KjyUserDB user_Utils;
//数据库用户名
private String USERNAME;// = "root";
private String USERNAME = "auto_test";
//数据库密码
private String PASSWORD; //= "yanzi";
private String PASSWORD = "881QYHoGGgc09Ngv"; //= "yanzi";
//驱动信息
private String DRIVER="com.mysql.cj.jdbc.Driver";
//数据库地址
private String URL;// = "jdbc:mysql://localhost:3306/mydb";
private String USER_URL="jdbc:mysql://rm-bp11mkg584kvjr485.mysql.rds.aliyuncs.com:3306/kjy_user";
private Connection connection;
private PreparedStatement pstmt;
private ResultSet resultSet;
private MysqlUtils(String username, String password, String url){
USERNAME = username;
PASSWORD = decode(password);
URL = url;
MysqlUtils mu = pool.get(url);
if(mu!=null){
System.out.println("--------exists");
connection = mu.connection;
}else{
connection = getConnection();
pool.put(url,this);
public static synchronized KjyUserDB getInstance(){
if (Objects.nonNull(user_Utils)){
return user_Utils;
}
// if(mu!=null) {
// try {
// mu.connection.close();
// } catch (Exception e) {
// System.out.println("mysql error:" + e.getMessage());
// }
// }
//// }else {
// connection = getConnection();
// pool.put(url,this);
}
/**
*
* @param username 用户名
* @param password 密码
* @param ip 数据库ip
* @param port 端口号
* @param databaseName 数据库名
*/
public MysqlUtils(String username, String password, String ip, String port, String databaseName){
this(username,password,"jdbc:mysql://"+ip+":"+port+"/"+databaseName);
user_Utils = new KjyUserDB();
user_Utils.initConnection();
return user_Utils;
}
/**
* 阿里云数据库连接
* @param databaseName 数据库名字
*/
public MysqlUtils(String databaseName){
this("tuia_test","dbseccode2CJMouQ2xyuEXnhe4vBzGtrDpaDbuK8Lt","47.111.157.152","3306",databaseName);
}
public static MysqlUtils mysqlDuiba(String databaseName){
return new MysqlUtils("tuia_test","dbseccode2CJMouQ2xyuEXnhe4vGtrDpavyDbuK8Lt","47.111.157.152","3306",databaseName);
}
/**
* 获得数据库的连接
* @return
*/
public Connection getConnection(){
private Connection initConnection(){
try {
try {
Class.forName(DRIVER);
......@@ -86,10 +40,7 @@ public class MysqlUtils {
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
// connection = DriverManager.getConnection(URL, USERNAME, PASSWORD);
// "jdbc:mysql://"+ip+":"+port+"/"+databaseName);
String url = URL+"?autoReconnect=true&testOnBorrow=true&testWhileIdle=true";
String url = USER_URL+"?autoReconnect=true&testOnBorrow=true&testWhileIdle=true";
connection = DriverManager.getConnection(url,USERNAME,PASSWORD);
System.out.println("数据库连接成功!");
} catch (SQLException e) {
......@@ -97,36 +48,7 @@ public class MysqlUtils {
}
return connection;
}
/**
* 增加、删除、改
* @param sql sql语句
* @param params 参数,替换 ?
* @return true or false
* @throws SQLException
*/
public boolean update(String sql, Object ...params)throws SQLException{
if(!connection.isValid(3)){
System.out.println("mysql connect is not vaild,reconnect.");
connection.close();
connection = getConnection();
pool.put(URL,this);
}
boolean flag = false;
int result = -1;
pstmt = connection.prepareStatement(sql);
int index = 1;
if(params != null && !(params.length==0)){
for(int i=0; i<params.length; i++){
pstmt.setObject(index++, params[i]);
}
}
System.out.println("SQL语句"+pstmt.toString());
result = pstmt.executeUpdate();
flag = result > 0 ? true : false;
return flag;
}
/**
* 查询结果只有一行数据
* @param sql sql语句
......@@ -138,8 +60,7 @@ public class MysqlUtils {
if(!connection.isValid(3)){
System.out.println("mysql connect is not vaild,reconnect.");
connection.close();
connection = getConnection();
pool.put(URL,this);
initConnection();
}
Map<String, Object> map = new HashMap<String, Object>();
int index = 1;
......@@ -177,8 +98,7 @@ public class MysqlUtils {
if(!connection.isValid(3)){
System.out.println("mysql connect is not vaild,reconnect.");
connection.close();
connection = getConnection();
pool.put(URL,this);
initConnection();
}
List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
int index = 1;
......@@ -218,22 +138,6 @@ public class MysqlUtils {
}
}
}
public static void main(String[] args) throws SQLException {
MysqlUtils jdbcUtils = new MysqlUtils("tuia_adver");
jdbcUtils.getConnection();
Map<String, Object> map = jdbcUtils.findSimpleResult("select * from account where company_name=?","兑吧科技有限公司");
jdbcUtils.releaseConn();
}
private static String decode(String value) {
if (value.startsWith(PREFIX)) {
value = value.substring(PREFIX.length());
return BlowfishUtils.decryptBlowfish(value, secret);
}
return value;
}
}
package com.kjj.sql;
public class UserSqlFactory {
private UserSqlFactory(){}
public static final String selectUserIdByUnionId = "select id from tb_users where union_id=?";
public static final String selectUserIdByOpenId = "SELECT user_id FROM `tb_users_wx_ext` WHERE `open_id` = ?";
}
package com.kjj.utils;
import com.kjj.sql.KjyUserDB;
import com.kjj.sql.UserSqlFactory;
import io.restassured.response.Response;
import org.testng.Assert;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import java.sql.SQLException;
import java.text.SimpleDateFormat;
import java.util.*;
import static com.kjj.config.BasicConfig.*;
import static com.kjj.utils.ThreadSleepUtils.sleep;
public class BaseUtils {
private static final NetworkUtils network = NetworkUtils.getInstance();
public static String tku;
/**
* 登录管理后台
......@@ -42,6 +46,102 @@ public class BaseUtils {
network.agentHeaders.put("X-Csrf-Token",ssoCookies.get("csrf_token"));
// 免登
network.agentCookies.put("sso_ticket", "autotest");
}
/**
* 小葡萄关注客集集微信公众号
*/
public static Object subscribe() throws SQLException {
//关注公众号
// network.agentHeaders.put("Content-Type","text/plain");
String str = "<xml><ToUserName><![CDATA[gh_3b9884c7b0ee]]></ToUserName><FromUserName><![CDATA[osi5w5kT-smQ42Fc-ByO4G8C-E1M]]></FromUserName><CreateTime>1628040971</CreateTime><MsgType><![CDATA[event]]></MsgType><Event><![CDATA[subscribe]]></Event></xml>";
Response response = network.postXMLResponse(str,MANAGER_oamsg);
System.out.println("关注\n"+response.body().asString());
sleep(1000);
network.agentHeaders.put("Content-Type","application/json");
Map<String, Object> result = KjyUserDB.getInstance().findSimpleResult(UserSqlFactory.selectUserIdByOpenId, "osi5w5kT-smQ42Fc-ByO4G8C-E1M");
Object userId = result.get("user_id");
Map<String, Object> params = new HashMap<String, Object>();
params.put("userId",userId);
params.put("validDays",365);
response = network.getResponse(params,MANAGER_encryptTku);
boolean success = response.jsonPath().getBoolean("success");
Assert.assertTrue(success,network.message(ROOKIEGUIDE_homeGuide,"接口返回失败",response.body().asString()));
tku = response.jsonPath().getString("data");
network.agentCookies.put("tku", tku);
System.out.println("小葡萄tku:" + tku);
return userId;
}
/**
* 小葡萄取关客集集微信公众号
*/
public static Object unsubscribe() throws SQLException {
//取关公众号
network.agentHeaders.put("Content-Type","text/plain");
String str = "<xml><ToUserName><![CDATA[gh_3b9884c7b0ee]]></ToUserName><FromUserName><![CDATA[osi5w5kT-smQ42Fc-ByO4G8C-E1M]]></FromUserName><CreateTime>1628040963</CreateTime><MsgType><![CDATA[event]]></MsgType><Event><![CDATA[unsubscribe]]></Event></xml>";
Response response = network.postXMLResponse(str,MANAGER_oamsg);
Map<String, Object> result = KjyUserDB.getInstance().findSimpleResult(UserSqlFactory.selectUserIdByOpenId, "osi5w5kT-smQ42Fc-ByO4G8C-E1M");
System.out.println("取关\n"+response.body().asString());
network.agentHeaders.put("Content-Type","application/json");
Object userId = result.get("user_id");
return userId;
}
/**
* 禁用
*/
public static void disableUser(long userId){
Map<String, Object> params = new HashMap<String, Object>();
params.put("userId",userId);
Response response = network.postResponse(params,MANAGER_disableUser);
boolean success = response.jsonPath().getBoolean("success");
boolean result = response.jsonPath().getBoolean("data");
System.out.println("禁用:"+response.body().asString());
Assert.assertTrue(success,network.message(params,MANAGER_disableUser,"接口返回失败",response.body().asString()));
Assert.assertTrue(result,network.message(params,MANAGER_disableUser,"返回数据为空",response.body().asString()));
}
/**
* 切换为会员
*/
public static void updateTypeOrDate(long userId){
//找到用户的sellerid
Map<String, Object> params = new HashMap<String, Object>();
Response response = network.getResponse(USER_INFO);
int sellerId = response.jsonPath().getInt("data.sellerId");
Assert.assertNotNull(response.jsonPath().getJsonObject("data"),network.message(USER_INFO,"获取用户信息失败",response.body().asString()));
//切换代理人公司
params.clear();
params.put("id",sellerId);
params.put("companyId",6);
response = network.getResponse(params,MANAGER_changeCompany);
System.out.println(params.toString());
boolean success = response.jsonPath().getBoolean("success");
boolean result = response.jsonPath().getBoolean("data");
System.out.println(response.body().asString());
Assert.assertTrue(success,network.message(params,MANAGER_changeCompany,"接口返回失败",response.body().asString()));
Assert.assertTrue(result,network.message(params,MANAGER_changeCompany,"返回数据为空",response.body().asString()));
//切换会员
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");//设置日期格式
Date date = new Date();// new Date()为获取当前系统时间
Calendar cal = Calendar.getInstance();
cal.setTime(date);
cal.add(Calendar.YEAR,1);
params.put("reason","测试账号");
params.put("sellerId",sellerId);
params.put("userVersion",2);
params.put("vipEndDate",df.format(date));
params.put("vipStartDate",df.format(cal.getTime()));
params.put("vipType",2);
response = network.postResponse(params,MANAGER_updateTypeOrDate);
success = response.jsonPath().getBoolean("success");
result = response.jsonPath().getBoolean("data");
Assert.assertTrue(success,network.message(params,MANAGER_updateTypeOrDate,"接口返回失败",response.body().asString()));
Assert.assertTrue(result,network.message(params,MANAGER_updateTypeOrDate,"返回数据为空",response.body().asString()));
}
}
......@@ -125,6 +125,11 @@
<class name="com.kjj.cases.live.FreeReward.FreeReward"/>
</classes>
</test>
<test preserve-order="true" name="我要咨询">
<classes>
<class name="com.kjj.cases.live.agent.Potential"/>
</classes>
</test>
<test preserve-order="true" name="访客领取资料">
<classes>
......
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