Commit eb1e5eb8 authored by 张艳玲's avatar 张艳玲

集客助手用户相关

parent 2accc348
......@@ -22,246 +22,209 @@ public interface Authorization {
/**
* 集客助手授权
* 集客助手相关授权
*/
//代理人
default void agentTku() {
AGENT_TKU = BaseUtils.createTku();
network.agentCookies.put("tku", AGENT_TKU);
System.out.println("代理人tku:" + AGENT_TKU);
}
// 获取访客tku:Su Yi
default void userTku() {
AGENT_TKU = BaseUtils.createTku();
String tku = BaseUtils.getTku(VISITOR_USERID);
network.agentCookies.put("tku", tku);
System.out.println("访客tku:" + tku);
network.agentCookies.put("tku", VISITOR_UserTku);
System.out.println("访客tku:" + VISITOR_UserTku);
}
// 获取访客tku:请勿打扰
default void userTku1() {
network.agentCookies.put("tku", VISITOR1_TKU);
System.out.println("访客tku:" + VISITOR1_TKU);
network.agentCookies.put("tku", VISITOR_TKU);
System.out.println("访客tku:" + VISITOR_TKU);
}
// 获取访客tku:小雪人
default void userTku2() {
network.agentCookies.put("tku", VISITOR1_TKU);
System.out.println("访客tku:" + VISITOR1_TKU);
}
// // 获取访客tku
// default void userTkuw() {
// AGENT_TKU = BaseUtils.createTku();
// VISITOR_TKU = BaseUtils.getTku(VISITOR_USERID);
// network.agentCookies.put("tku", VISITOR_TKU);
// System.out.println("访客tku:" + VISITOR_TKU);
// }
/**
* 代理人(yl)授权,ID:826
* 直播业务相关
*/
//代理人(yl)授权,ID:826
default void agentAuth(){
// 创建用户 并传到network里
network.agentCookies.put("authKey",AUTH_KEY);
System.out.println("用户AUTH_KEY:"+AUTH_KEY);
}
/**
* 代理人(小疙瘩人寿)授权,ID:995
*/
//代理人(小疙瘩人寿)授权,ID:995
default void agentAuth1(){
// 创建用户 并传到network里
network.agentCookies.put("authKey",agentAuth);
System.out.println("用户AUTH_KEY:"+agentAuth);
}
/**
* 访客A(志勇)授权,代理人指定中奖用户,ID:107
*/
//访客A(志勇)授权,代理人指定中奖用户,ID:107
default void visitorAuth() {
network.agentCookies.put("authKey", visitorAuth);
System.out.println("用户AUTH_KEY:" + visitorAuth);
}
/**
* 访客B(茶仔)授权,用户ID:122
*/
//访客B(茶仔)授权,用户ID:122
default void visitorAuth2() {
network.agentCookies.put("authKey", visitorAuth2);
System.out.println("用户AUTH_KEY:" + visitorAuth2);
}
/**
* 访客C(刘超)授权,地域指定用户ID:811
*/
//访客C(刘超)授权,地域指定用户ID:811
default void visitorAuth3() {
network.agentCookies.put("authKey", visitorAuth3);
System.out.println("用户AUTH_KEY:" + visitorAuth3);
}
/**
* 访客D(李执)授权,地域指定用户ID:89
*/
//访客D(李执)授权,地域指定用户ID:89
default void visitorAuth4() {
network.agentCookies.put("authKey", visitorAuth4);
System.out.println("用户AUTH_KEY:" + visitorAuth4);
}
/**
* 访客E(周成)授权,企业指定中奖用户,用户ID:812
*/
//访客E(周成)授权,企业指定中奖用户,用户ID:812
default void visitorAuth5() {
network.agentCookies.put("authKey", visitorAuth5);
System.out.println("用户AUTH_KEY:" + visitorAuth5);
}
/**
* 访客F(新强)授权,用户ID:82
*/
//访客F(新强)授权,用户ID:82
default void visitorAuth6() {
network.agentCookies.put("authKey", visitorAuth6);
System.out.println("用户AUTH_KEY:" + visitorAuth6);
}
/**
* 访客G(熊二)授权,黑名单用户,ID:719
*/
//访客G(熊二)授权,黑名单用户,ID:719
default void visitorAuth7() {
network.agentCookies.put("authKey", visitorAuth7);
System.out.println("用户AUTH_KEY:" + visitorAuth7);
}
/**
* 访客I(熊大)授权 ID:1239
*/
//访客I(熊大)授权 ID:1239
default void visitorAuth8() {
network.agentCookies.put("authKey", visitorAuth8);
System.out.println("用户AUTH_KEY:" + visitorAuth8);
}
/**
* 访客H(吉吉)非实名用户授权,ID:907
*/
//访客H(吉吉)非实名用户授权,ID:907
default void visitorAuth9() {
network.agentCookies.put("authKey", visitorAuth9);
System.out.println("用户AUTH_KEY:" + visitorAuth9);
}
/**
* 访客J(日落)授权,ID:703
*/
//访客J(日落)授权,ID:703
default void visitorAuth10() {
network.agentCookies.put("authKey", visitorAuth10);
System.out.println("用户AUTH_KEY:" + visitorAuth10);
}
/**
* 访客K(沈小四)授权,ID:108
*/
//访客K(沈小四)授权,ID:108
default void visitorAuth11() {
network.agentCookies.put("authKey", visitorAuth11);
System.out.println("用户AUTH_KEY:" + visitorAuth11);
}
/**
* 访客L(饺子)授权,ID:97
*/
//访客L(饺子)授权,ID:97
default void visitorAuth12() {
network.agentCookies.put("authKey", visitorAuth12);
System.out.println("用户AUTH_KEY:" + visitorAuth12);
}
/**
* 访客M(大妹子)非实名用户授权,ID:299
*/
//访客M(大妹子)非实名用户授权,ID:299
default void visitorAuth13() {
network.agentCookies.put("authKey", visitorAuth13);
System.out.println("用户AUTH_KEY:" + visitorAuth13);
}
/**
* 访客N(光头强)非实名用户授权,ID:540
*/
//访客N(光头强)非实名用户授权,ID:540
default void visitorAuth14() {
network.agentCookies.put("authKey", visitorAuth14);
System.out.println("用户AUTH_KEY:" + visitorAuth14);
}
/**
* 访客O(少侠)授权,ID:79
*/
//访客O(少侠)授权,ID:79
default void visitorAuth15() {
network.agentCookies.put("authKey", visitorAuth15);
System.out.println("用户AUTH_KEY:" + visitorAuth15);
}
/**
* 访客P(抬头有飞碟)授权,ID:99
*/
//访客P(抬头有飞碟)授权,ID:99
default void visitorAuth16() {
network.agentCookies.put("authKey", visitorAuth16);
System.out.println("用户AUTH_KEY:" + visitorAuth16);
}
/**
* 访客Q(枫城)授权,ID:77
*/
//访客Q(枫城)授权,ID:77
default void visitorAuth17() {
network.agentCookies.put("authKey", visitorAuth17);
System.out.println("用户AUTH_KEY:" + visitorAuth17);
}
/**
* 访客R(小老弟来了)非实名用户授权,ID:94
*/
//访客R(小老弟来了)非实名用户授权,ID:94
default void visitorAuth18() {
network.agentCookies.put("authKey", visitorAuth18);
System.out.println("用户AUTH_KEY:" + visitorAuth18);
}
/**
* 访客T(林国芸)ID:786
*/
//访客T(林国芸)ID:786
default void visitorAuth19() {
network.agentCookies.put("authKey", visitorAuth19);
System.out.println("用户AUTH_KEY:" + visitorAuth19);
}
/**
* 访客Y(孙心桂)ID:785
*/
//访客Y(孙心桂)ID:785
default void visitorAuth20() {
network.agentCookies.put("authKey", visitorAuth20);
System.out.println("用户AUTH_KEY:" + visitorAuth20);
}
/**
* 访客W(谢翊美)ID:791
*/
//访客W(谢翊美)ID:791
default void visitorAuth21() {
network.agentCookies.put("authKey", visitorAuth21);
System.out.println("用户AUTH_KEY:" + visitorAuth21);
}
/**
* 访客V(zzz666)ID:849
*/
//访客V(zzz666)ID:849
default void visitorAuth22() {
network.agentCookies.put("authKey", visitorAuth22);
System.out.println("用户AUTH_KEY:" + visitorAuth22);
}
/**
* 访客u(七凉)ID:179
*/
//访客u(七凉)ID:179
default void visitorAuth23() {
network.agentCookies.put("authKey", visitorAuth23);
System.out.println("用户AUTH_KEY:" + visitorAuth23);
}
/**
* 访客S(奶汪)ID:1170 实名
*/
//访客S(奶汪)ID:1170 实名
default void visitorAuth24() {
network.agentCookies.put("authKey", visitorAuth24);
System.out.println("用户AUTH_KEY:" + visitorAuth24);
}
/**
* 访客S(亦心)ID:96 实名
*/
//访客S(亦心)ID:96 实名
default void visitorAuth25() {
network.agentCookies.put("authKey", visitorAuth25);
System.out.println("用户AUTH_KEY:" + visitorAuth25);
......
......@@ -31,13 +31,8 @@ public class DailyPaper implements Authorization {
@BeforeClass
public void setUp() {
BaseUtils.ssoLogin();
// 创建用户 并传到network里
AGENT_TKU = BaseUtils.createTku();
network.agentCookies.put("tku",AGENT_TKU);
//System.out.println("代理人tku:"+AGENT_TKU);
// 获取访客tku
VISITOR_TKU = BaseUtils.getTku(VISITOR_USERID);
//System.out.println("访客tku:"+VISITOR_TKU);
agentTku();
userTku();
}
@Test (description = "今日早报_获取今日早报列表",priority = 1)
......
......@@ -2,6 +2,7 @@ package com.kjj.cases.assistant;
import static com.kjj.config.BasicConfig.*;
import com.kjj.cases.admin.Authorization;
import com.kjj.utils.BaseUtils;
import com.kjj.utils.NetworkUtils;
import io.restassured.response.Response;
......@@ -17,15 +18,15 @@ import java.util.Date;
import java.util.HashMap;
import java.util.Map;
public class Pay {
public class Pay implements Authorization {
private static final NetworkUtils network = NetworkUtils.getInstance();
@BeforeClass
public static void setUp() {
// 创建用户 并传到network里
AGENT_TKU = BaseUtils.createTku();
network.agentCookies.put("tku",AGENT_TKU);
public void setUp() {
BaseUtils.ssoLogin();
agentTku();
userTku();
}
public String comboId;
public long id;
......@@ -146,6 +147,7 @@ public class Pay {
@Test (description = "创建优惠码",priority = 6)
public void 创建优惠码 () {
//优惠码类型列表
Response response=network.getResponse(MANAGER_typeList);
System.out.println(response.body().asString());
......@@ -260,5 +262,8 @@ public class Pay {
}
}
......@@ -31,13 +31,8 @@ public class RecommendMaterial implements Authorization {
@BeforeClass
public void setUp() {
// 创建用户 并传到network里
AGENT_TKU = BaseUtils.createTku();
network.agentCookies.put("tku", AGENT_TKU);
//System.out.println("代理人tku:"+AGENT_TKU);
// 获取访客tku
VISITOR_TKU = BaseUtils.getTku(VISITOR_USERID);
//System.out.println("访客tku:"+VISITOR_TKU);
userTku();
agentTku();
}
//种草文章列表页
......
......@@ -23,13 +23,8 @@ public class homePage implements Authorization {
@BeforeClass
public void setUp() {
// 创建用户 并传到network里
AGENT_TKU = BaseUtils.createTku();
network.agentCookies.put("tku", AGENT_TKU);
//System.out.println("代理人tku:"+AGENT_TKU);
// 获取访客tku
VISITOR_TKU = BaseUtils.getTku(VISITOR_USERID);
//System.out.println("访客tku:"+VISITOR_TKU);
agentTku();
userTku();
}
//获取种草素材列表页
......
package com.kjj.cases.basics;
import com.kjj.utils.NetworkUtils;
import com.kjj.utils.ThreadSleepUtils;
import io.restassured.response.Response;
import org.testng.Assert;
import org.testng.annotations.*;
import org.testng.annotations.Test;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static com.kjj.config.BasicConfig.*;
public class CircleFriends {
private static final NetworkUtils network = NetworkUtils.getInstance();
public int firstTagId;
public String contentId;
public String tagId;
public String tagName;
@BeforeClass
public void setUp() {
}
@Test(description="是否首次进入",priority = 1)
public void 是否首次进入() {
Response response = network.getResponse(FRIENDS_ISUSERFIRSTENTERANDCOLLECT);
String desc = response.jsonPath().getString("desc");
Assert.assertEquals(desc,"OK",network.message(FRIENDS_ISUSERFIRSTENTERANDCOLLECT,"是否首次进入和首次收藏发圈素材列表-接口有误",response.body().asString()));
}
// tab列表 后端根据tku自行判断
@Test(description="获取tab列表",priority = 2)
public void 获取tab列表() {
Response response = network.getResponse(FRIENDS_GETMATERIALTAGS);
boolean hasList = response.jsonPath().getInt("data.size()") > 0;
int id = response.jsonPath().getInt("data.find {it.name == '保险'}.id"); //标签tab
firstTagId = response.jsonPath().getInt("data[0].id");//第一个标签的ID
Assert.assertTrue(hasList,network.message(FRIENDS_GETMATERIALTAGS,"获取tab数量有误",response.body().asString()));
Assert.assertEquals(id,595,network.message(FRIENDS_GETMATERIALTAGS,"获取tab中不包含保险",response.body().asString()));
}
@Test(description="获取推荐(未读)列表",priority = 3)
public void 获取推荐列表() throws IOException {
Map<String, Object> params = new HashMap<String, Object>();
params.put("firstTagId",firstTagId);
Response response = network.getResponse(params,FRIENDS_GETUNREADTIMELINSLIST);
int count = response.jsonPath().getInt("data.size()");
contentId = response.jsonPath().getString("data[0].contentId"); //素材ID
tagId = response.jsonPath().getString("data[0].materialTag"); //素材频道ID
tagName = response.jsonPath().getString("data[0].tagName"); //素材频道名称
Assert.assertTrue(count>1,network.message(params,FRIENDS_GETUNREADTIMELINSLIST,"获取推荐列表有误",response.body().asString()));
}
@Test(description="获取全部列表",priority = 4)
public void 获取全部列表() throws IOException {
Map<String, Object> params = new HashMap<String, Object>();
params.put("firstTagId",firstTagId);
params.put("pageIndex",1);
params.put("pageSize",10);
Response response = network.getResponse(params,FRIENDS_GETTIMELINELIST);
int count = response.jsonPath().getInt("data.list.size()");
Assert.assertEquals(count,10,"获取未读列表有误");
}
@Test(description="素材标记为已读",priority = 5)
public void 素材标记为已读() throws IOException, InterruptedException {
//标记为已读
Map<String, Object> params = new HashMap<String, Object>();
params.put("contentId",contentId);
params.put("firstTagId",firstTagId);
Response response = network.postResponse(params,FRIENDS_ASYNCMARKTIMELINEREAD);
boolean data = response.jsonPath().getBoolean("data");
Assert.assertTrue(data,network.message(params,FRIENDS_ASYNCMARKTIMELINEREAD,"标记已读-接口有误",response.body().asString()));
//延迟2秒,存入ES
ThreadSleepUtils.sleep(5000);
//重新获取未读列表
response = network.getResponse(params,FRIENDS_GETUNREADTIMELINSLIST);
List<String> contentList = response.jsonPath().getList("data.contentId");
boolean unRead = contentList.contains(contentId); //检查是否未读,false为已读,true为未读
Assert.assertFalse(unRead,network.message(params,FRIENDS_GETUNREADTIMELINSLIST,"已读后,未读接口没有过滤已读素材",response.body().asString()));
}
@Test(description="收藏素材",priority = 6)
public void 收藏素材() throws IOException {
// 收藏素材
Map<String, Object> params = new HashMap<String, Object>();
params.put("contentId",contentId);
params.put("operate",1);
Response response = network.getResponse(params,FRIENDS_ADDORCANCELCOLLECT);
boolean isAdd = response.jsonPath().getBoolean("data");
Assert.assertTrue(isAdd,network.message(params,FRIENDS_ADDORCANCELCOLLECT,"收藏素材失败",response.body().asString()));
// 查看收藏列表
params.put("pageSize",12);
response = network.getResponse(params,FRIENDS_QUERYLISTFORCOLLECT);
String collectContentId = response.jsonPath().getString("data[0].contentId");
Assert.assertEquals(collectContentId,contentId,network.message(params,FRIENDS_QUERYLISTFORCOLLECT,"收藏列表有误",response.body().asString()));
// 取消收藏
params.put("operate",2);
response = network.getResponse(params,FRIENDS_ADDORCANCELCOLLECT);
boolean isCancel = response.jsonPath().getBoolean("data");
Assert.assertTrue(isCancel,network.message(params,FRIENDS_ADDORCANCELCOLLECT,"取消收藏素材失败",response.body().asString()));
}
@Test(description="素材频道页",priority = 7)
public void 素材频道页() throws IOException {
//频道页 头部
ThreadSleepUtils.sleep(500);
Map<String, Object> params = new HashMap<String, Object>();
params.put("tagId",tagId);
Response response = network.getResponse(params,FRIENDS_CHANNELDETAIL);
String name = response.jsonPath().getString("data.tagName");
Assert.assertEquals(name,tagName,network.message(params,FRIENDS_CHANNELDETAIL,"素材频道页-头部获取有误",response.body().asString()));
//频道页 列表
params.put("pageSize",10);
params.put("pageNo",1);
response = network.getResponse(params,FRIENDS_GETCHANNELLIST);
String collectTagtId = response.jsonPath().getString("data[0].materialTag"); //素材ID
boolean hasList = response.jsonPath().getInt("data.size()") > 0;
Assert.assertEquals(collectTagtId,tagId,network.message(params,FRIENDS_GETCHANNELLIST, "素材列表获取有误",response.body().asString()));
Assert.assertTrue(hasList,network.message(params,FRIENDS_GETCHANNELLIST,"素材频道列表-获取有误",response.body().asString()));
}
@Test(description="从首页发圈列表页进入",priority = 8)
public void 从首页发圈列表页进入() throws IOException {
// 获取首页发圈素材列表
Response response = network.getResponse(HOME_GETHOMETIMELINECONTENT);
String currentId = response.jsonPath().getString("data.materialVos[0].contentId");
Assert.assertNotNull(currentId,network.message(HOME_GETHOMETIMELINECONTENT,"获取首页发圈列表有误",response.body().asString()));
// 如果有推荐列表,进入发圈
if (currentId.length() > 0){
Map<String, Object> params = new HashMap<String, Object>();
params.put("currentId",currentId);
response = network.getResponse(params,FRIENDS_GETCURRENTINFO);
String topContentId = response.jsonPath().getString("data.contentId");
Assert.assertEquals(topContentId,currentId,network.message(params,FRIENDS_GETCURRENTINFO,"从首页进入发圈的头部素材有误",response.body().asString()));
}
}
}
......@@ -176,37 +176,7 @@ public class Novice {
Assert.assertEquals(code,1,network.message(NOVICE_LIST,"上传文章-完成新手任务 失败",response.body().asString()));
}
// 收到好友转发访问 该接口已废弃
// @Test (description = "新手任务_收到好友转发访问",priority = 9) //priorty 方法执行优先级
// public void 新手任务_收到好友转发访问() throws IOException {
// //获取列表中"收到好友转发访问"的任务
// Response response = network.getResponse("/kjy/mp/seller/novice/list");
//
// //获取任务名为"收到好友转发访问"的任务状态 code: 0未完成 1可领奖励 2已完成
// int code = response.jsonPath().getInt("data.find {it.taskName == '收到好友转发访问'}.taskStatus.code");
// Assert.assertEquals(code,0,"获取新手任务初始状态-收到好友转发访问 失败");
//
// //收到好友转发访问
// network.agentCookies.put("tku",network.visitorTku); //tku 切换为访客的
//
// Map<String, Object> params = new HashMap<String, Object>();
// params.put("scId","Kj20MTMwMDM5");//文章scId
// params.put("forwardType",2);// 1:个人/微信群 2:朋友圈
// response = network.getResponse(params,"/kjy/mp/forward");
// boolean data = response.jsonPath().getBoolean("data");
// Assert.assertTrue(data,"收到好友转发访问-好友转发到朋友圈 失败");
//
// network.agentCookies.put("tku",network.agentTku); //tku 切换为代理人的
//
//// //重新获取任务名为"收到好友转发访问"的任务状态,验证任务是否生效
//// response = network.getResponse("/kjy/mp/seller/novice/list");
//// //获取任务名为"收到好友转发访问"的任务状态 code: 0未完成 1可领奖励 2已完成
//// code = response.jsonPath().getInt("data.find {it.taskName == '收到好友转发访问'}.taskStatus.code");
//// Assert.assertEquals(code,1,"收到好友转发访问-新手任务完成状态 获取失败");
//
//
//
// }
//查看访问客户
@Test (description = "新手任务_查看访问客户",priority = 9) //priorty 方法执行优先级
......
This diff is collapsed.
......@@ -281,13 +281,13 @@ public class FlipCard implements Authorization {
Response response = network.getResponse(params, BasicConfig.MOBILE_record);
System.out.println(response.body().asString());
int leftNum =response.jsonPath().getJsonObject("data.leftNum");
Assert.assertTrue(leftNum==4, network.message(params, BasicConfig.MOBILE_record, "翻牌次数不足", response.body().asString()));
Assert.assertTrue(leftNum==5, network.message(params, BasicConfig.MOBILE_record, "翻牌次数不足", response.body().asString()));
visitorAuth22();
Response recordRes= network.getResponse(params, BasicConfig.MOBILE_record);
System.out.println(recordRes.body().asString());
int leftNum1 =response.jsonPath().getJsonObject("data.leftNum");
Assert.assertTrue(leftNum1==4, network.message(params, BasicConfig.MOBILE_record, "翻牌次数不足", recordRes.body().asString()));
Assert.assertTrue(leftNum1==5, network.message(params, BasicConfig.MOBILE_record, "翻牌次数不足", recordRes.body().asString()));
}
......
......@@ -77,6 +77,9 @@ public class BasicConfig {
public static final String sids = "Kj21MjMwNTU";
// 访客的userId(固定)--"Su Yi"
public static final int VISITOR_USERID = 4425;
public static String VISITOR_UserTku = "T3gM31f18jAW2hicRDxbwHFSuwA4MMVLLeHZ5G4yvb3sz6YRdcqKfzRJ8dMnfqDmgS8EprRjhFpXPFLBvp";
// 客集云公众号的oaSourceId(固定)
public static final String OASOURCE_ID = "gh_3b9884c7b0ee";
// 钉钉机器人 线上-告警群
......
......@@ -45,168 +45,5 @@ public class BaseUtils {
}
/**
* 获取 sellerId
* @return sellerId
*/
public static String getSellerId (){
Response response = network.getResponse(USER_INFO);
return response.jsonPath().getString("data.sellerId");
}
/**
* 获取 userId
* @return userId
*/
public static String getUserId (){
Response response = network.getResponse(USER_INFO);
return response.jsonPath().getString("data.userId");
}
/**
* 切换vip
* @param userVersion 1是通用版 2是保险版
* @param vipType 1是普通用户 2是vip用户
*/
public static void switchVip(int userVersion, int vipType) {
String sellerId = getSellerId();
// 登录下,检验是否失效
ssoLogin();
// 1.切换公司为客集集
Map<String, Object> changeParams = new HashMap<String, Object>();
changeParams.put("id",sellerId);
changeParams.put("companyId",6);
Response response = network.getResponse(changeParams,MANAGER_changeCompany);
response.body().prettyPrint();
// 2.切换为保险版vip
Map<String, Object> switchVipParams = new HashMap<String, Object>();
switchVipParams.put("reason","1");
switchVipParams.put("sellerId",sellerId);
switchVipParams.put("userVersion",userVersion);
switchVipParams.put("vipType",vipType);
switchVipParams.put("vipStartDate",System.currentTimeMillis());
switchVipParams.put("vipEndDate",System.currentTimeMillis() + 1000*3600*24*365L);
response = network.postResponse(switchVipParams,MANAGER_updateTypeOrDate);
// 3.切换公司为空
changeParams.remove("companyId",6); //去掉公司
response = network.getResponse(changeParams,MANAGER_changeCompany);
// 删除管理后台tku
network.agentHeaders.remove("X-Csrf-Token");
network.agentCookies.remove("sso_ticket");
network.agentCookies.remove("device_no");
network.agentCookies.remove("csrf_token");
}
/**
* 标记为内部人员
* @param isInternalSeller 1:内部人员 0:非内部人员
*/
public static void switchInsider(int isInternalSeller){
String sellerId = getSellerId();
// 登录下,检验是否失效
ssoLogin();
Map<String, Object> params = new HashMap<String, Object>();
params.put("id",sellerId);
params.put("internalSeller",isInternalSeller);//
Response response = network.getResponse(params,MANAGER_setInternalSeller);
response.body().prettyPrint();
// 删除管理后台tku
network.agentHeaders.remove("X-Csrf-Token");
network.agentCookies.remove("sso_ticket");
network.agentCookies.remove("device_no");
network.agentCookies.remove("csrf_token");
}
/**
* 创建用户和tku
*/
public static String createTku(){
// 创建userId
Map<String, Object> params = new HashMap<String, Object>();
params.put("openId",OPEN_ID);
params.put("oaSourceId",OASOURCE_ID);
Response response = network.getResponse(params,CREATE_USER);
long userId = response.jsonPath().getLong("data");
response.body().prettyPrint();
// 创建tku
Map<String, Object> tkuParams = new HashMap<String, Object>();
tkuParams.put("userId",userId);
response = network.getResponse(tkuParams,AUTOTEST_TKU);
response.body().prettyPrint();
String tku = "";
try {
// 判断tku 是否有效
tku = response.jsonPath().getString("data");
Assert.assertNotNull(tku);
} catch (AssertionError e) {
System.out.println("获取tku失败");
DingTalkUtils.sendError("测试停止-获取tku失败! \n"+
"path: " + AUTOTEST_TKU + "\n" +
"params: " + params + "\n" +
"response: "+response.body().asString());
throw new RuntimeException();
}
// tku赋值
return tku;
}
/**
* 获取tku
* @param userId 用户id
* @return 用户tku
*/
public static String getTku(int userId){
Map<String, Object> tkuParams = new HashMap<String, Object>();
tkuParams.put("userId",userId);
Response response = network.getResponse(tkuParams,AUTOTEST_TKU);
response.body().prettyPrint();
return response.jsonPath().getString("data");
}
/**
* 账号禁用
*/
public static void disableUser() {
// 获取sellerId、userId
String sellerId = getSellerId();
String userId = getUserId();
// 取关公众号
Map<String, Object> unsubscribeParams = new HashMap<String, Object>();
unsubscribeParams.put("userId",userId);
unsubscribeParams.put("oaId",1);
Response response = network.getResponse(unsubscribeParams,AUTOTEST_UNSUBSCRIBE);
System.out.println(response.statusCode());
// 登录下,检验是否失效
ssoLogin();
// 公司改为客集集
Map<String, Object> changeParams = new HashMap<String, Object>();
changeParams.put("id",sellerId);
changeParams.put("companyId",6);
response = network.getResponse(changeParams,MANAGER_changeCompany);
// 删除账号
Map<String, Object> params = new HashMap<String, Object>();
params.put("userId",userId);
response = network.postResponse(params,MANAGER_disableUser);
response.body().prettyPrint();
}
}
......@@ -219,10 +219,6 @@ public class MysqlUtils {
}
}
public static void main(String[] args) throws SQLException {
// JdbcUtils jdbc = new JdbcUtils("root", "root", "com.mysql.jdbc.Driver", "jdbc:mysql://localhost:3306/learning");
//
// Map<String, Object> map = jdbc.findSimpleResult("select * from t_user where USER_ID='1'", null);
MysqlUtils jdbcUtils = new MysqlUtils("tuia_adver");
jdbcUtils.getConnection();
Map<String, Object> map = jdbcUtils.findSimpleResult("select * from account where company_name=?","兑吧科技有限公司");
......
This diff is collapsed.
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