Commit aa1cbe27 authored by 郭姣's avatar 郭姣

企业后台代理人端接口提交

parent ec1c20cd
package com.kjj.cases.assistant.enterpriseAgent;
import com.kjj.bean.corp.BizTypeBean;
import com.kjj.cases.admin.Authorization;
import com.kjj.config.BasicConfig;
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.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static com.kjj.utils.BaseUtils.ssoLogin;
import static com.kjj.utils.BaseUtils.superUserLogin;
public class EnterpriseAgent implements Authorization {
@BeforeClass
public void setup() {
visitor2Tku();
superUserLogin();
ssoLogin();
}
public Object deptId; //企业后台的营业部id
public Object testDeptId; //企业后台的备用营业部id
public Object activityId; //企业后台新增的活动id
public int totalCount; //企业后台活动数量
public Object customerUserId; //代理人端获取直播线索客户id
@Test(description = "激活账号", priority = 1)
public void 激活账号() {
Map<String, Object> params = new HashMap<>();
params.put("corpCompanyId", "Kj20MjE1");
params.put("jobNumber", "KJJ000");
Response response = network.postResponse(params, BasicConfig.HOME_employeeActivate);
boolean data = response.jsonPath().getBoolean("data");
Assert.assertTrue(data, network.message(params, BasicConfig.HOME_employeeActivate, "用户激活失败", response.body().asString()));
}
@Test(description = "企业后台工号已激活", priority = 2)
public void 企业后台工号已激活() {
//获取企业后台营业部id
Response listRes = network.getResponse(BasicConfig.CORP_simpleList);
deptId = listRes.jsonPath().getJsonObject("data.get(1).id");
testDeptId = listRes.jsonPath().getJsonObject("data.get(0).id");
System.out.println(deptId);
Map<String, Object> params = new HashMap<>();
params.put("pageSize", 8);
params.put("pageIndex", 1);
params.put("deptId", deptId);
Response response = network.getResponse(params, BasicConfig.CORP_employeeList);
int activatedStatus = response.jsonPath().getInt("data.list[0].activatedStatus");
Assert.assertEquals(activatedStatus, 1, network.message(params, BasicConfig.CORP_employeeList, "企业后台工号未显示已激活", response.body().asString()));
}
@Test(description = "企业后台_已激活数量", priority = 3)
public void 企业后台_已激活数量() {
superUserLogin();
Response response = network.getResponse(BasicConfig.CORP_employeeStat);
int activateCount = response.jsonPath().getInt("data.activateCount");
Assert.assertEquals(activateCount, 1, network.message(BasicConfig.CORP_employeeStat, "已激活数量统计错误", response.body().asString()));
}
@Test(description = "查看代理人端直播页", priority = 4)
public void 查看代理人端直播页() {
Map<String, Object> params = new HashMap<>();
params.put("pageIndex", 1);
params.put("pageSize", 10);
Response response = network.getResponse(params, BasicConfig.HOME_corpLiveList);
Object list = response.jsonPath().getJsonObject("data.list");
Assert.assertNotNull(list, network.message(params, BasicConfig.HOME_corpLiveList, "直播页获取失败", response.body().asString()));
}
@Test(description = "短链跳转直播小程序", priority = 5)
public void 短链跳转直播小程序() {
Map<String, Object> params = new HashMap<>();
params.put("type", 1);
Response response = network.getResponse(params, BasicConfig.HOME_liveShortLink);
boolean success = response.jsonPath().getBoolean("success");
Assert.assertTrue(success, network.message(params, BasicConfig.HOME_liveShortLink, "跳转直播小程序失败", response.body().asString()));
}
@Test(description = "获取企业版公司信息", priority = 6)
public void 获取企业版公司信息() {
Map<String, Object> params = new HashMap<>();
params.put("corpCompanyId", "Kj20MjE1");
Response response = network.getResponse(params, BasicConfig.HOME_corpCompanyInfo);
Object data = response.jsonPath().getJsonObject("data");
Assert.assertNotNull(data, network.message(params, BasicConfig.HOME_corpCompanyInfo, "获取企业版公司信息失败", response.body().asString()));
}
@Test(description = "获取用户权限", priority = 7)
public void 获取用户权限() {
//代理人权限为集客助手+直播权限
Response response = network.getResponse(BasicConfig.HOME_employeeAuth);
int authType = response.jsonPath().getInt("data.authType");
Assert.assertEquals(authType, 3, network.message(BasicConfig.HOME_employeeAuth, "获取用户权限错误", response.body().asString()));
}
@Test(description = "编辑公司权限后获取用户权限", priority = 8)
public void 编辑公司权限后获取用户权限() {
//编辑公司权限为集客助手
Map<String, Object> params = new HashMap<>();
params.put("authExpiryDate", "1669737600000");
params.put("companyLevel", 1);
params.put("companyLogo", "//yun.dui88.com/kjy/image/20211115/1636965273816.webp");
params.put("companyName", "【勿动】自动化测试专用");
params.put("employeeNum", 3);
params.put("id", 26);
List<BizTypeBean> bizTypes = new ArrayList<>();
BizTypeBean bizType1 = new BizTypeBean();
bizType1.setBizType(1);
bizType1.setBizCompanyId(6);
bizTypes.add(bizType1);
params.put("bizTypeList", bizTypes);
Response response = network.postResponse(params, BasicConfig.MANAGER_companySaveOrUpdate);
boolean data = response.jsonPath().getBoolean("data");
Assert.assertTrue(data, network.message(params, BasicConfig.MANAGER_companySaveOrUpdate, "编辑企业信息正确", response.body().asString()));
//代理人权限为集客助手权限
Response employeeRes = network.getResponse(BasicConfig.HOME_employeeAuth);
int authType = employeeRes.jsonPath().getInt("data.authType");
Assert.assertEquals(authType, 2, network.message(BasicConfig.HOME_employeeAuth, "获取用户权限错误", employeeRes.body().asString()));
}
@Test(description = "恢复公司权限", priority = 9)
public void 恢复公司权限() {
Map<String, Object> params = new HashMap<>();
params.put("authExpiryDate", "1669737600000");
params.put("companyLevel", 1);
params.put("companyLogo", "//yun.dui88.com/kjy/image/20211115/1636965273816.webp");
params.put("companyName", "【勿动】自动化测试专用");
params.put("employeeNum", 3);
params.put("id", 26);
List<BizTypeBean> bizTypes = new ArrayList<>();
BizTypeBean bizType1 = new BizTypeBean();
bizType1.setBizType(1);
bizType1.setBizCompanyId(6);
bizTypes.add(bizType1);
BizTypeBean bizType2 = new BizTypeBean();
bizType2.setBizType(2);
bizType2.setBizCompanyId(101);
bizTypes.add(bizType2);
BizTypeBean bizType3 = new BizTypeBean();
bizType3.setBizType(3);
bizType3.setBizCompanyId(0);
bizTypes.add(bizType3);
params.put("bizTypeList", bizTypes);
Response response = network.postResponse(params, BasicConfig.MANAGER_companySaveOrUpdate);
boolean data = response.jsonPath().getBoolean("data");
Assert.assertTrue(data, network.message(params, BasicConfig.MANAGER_companySaveOrUpdate, "编辑企业信息正确", response.body().asString()));
}
@Test(description = "查询用户信息", priority = 10)
public void 查询用户信息() {
Response response = network.getResponse(BasicConfig.HOME_employeeInfo);
Object data = response.jsonPath().getJsonObject("data");
Assert.assertNotNull(data, network.message(BasicConfig.HOME_employeeInfo, "查询用户信息失败", response.body().asString()));
}
/**
* 活动通知
**/
@Test(description = "企业后台_获取活动列表", priority = 12)
public void 企业后台_获取活动列表() {
Map<String, Object> params = new HashMap<>();
params.put("pageIndex", 1);
params.put("pageSize", 6);
Response response = network.getResponse(params, BasicConfig.CORP_corpActivityList);
boolean success = response.jsonPath().getBoolean("success");
Assert.assertTrue(success, network.message(params, BasicConfig.CORP_corpActivityList, "获取活动列表错误", response.body().asString()));
String activityIdNew = response.jsonPath().getJsonObject("data.list[0].activityId");
Assert.assertNotNull(activityIdNew, network.message(params, BasicConfig.CORP_corpActivityList, "获取活动列表错误", response.body().asString()));
//获取活动数量
totalCount = response.jsonPath().getInt("data.totalCount");
System.out.println(totalCount);
}
@Test(description = "企业后台_新增活动", priority = 13)
public void 企业后台_新增活动() {
Map<String, Object> params = new HashMap<>();
params.put("activityDesc", "自动化测试活动的描述");
params.put("activityName", "自动化测试活动");
List activityCoverList = new ArrayList();
activityCoverList.add("https://yun.dui88.com/kjy/corp/image/20211201/1638353310973.png");
List sendDeptIdList = new ArrayList();
sendDeptIdList.add(deptId);
params.put("activityCoverList",activityCoverList);
params.put("sendDeptIdList",sendDeptIdList);
Response response = network.postResponse(params, BasicConfig.CORP_corpActivitySave);
boolean data = response.jsonPath().getBoolean("data");
Assert.assertTrue(data, network.message(params, BasicConfig.CORP_corpActivitySave, "新增活动失败", response.body().asString()));
//获取新增的活动id
params.clear();
params.put("pageIndex", 1);
params.put("pageSize", 6);
Response listRes = network.getResponse(params, BasicConfig.CORP_corpActivityList);
activityId = listRes.jsonPath().getJsonObject("data.list[0].activityId");
System.out.println(activityId);
Assert.assertNotNull(activityId, network.message(params, BasicConfig.CORP_corpActivityList, "获取活动id失败", listRes.body().asString()));
}
@Test(description = "企业后台_获取活动详情", priority = 14)
public void 企业后台_获取活动详情() {
Map<String, Object> params = new HashMap<>();
params.put("activityId", activityId);
Response response = network.getResponse(params, BasicConfig.CORP_corpActivityDetail);
String sendDeptName = response.jsonPath().getString("data.sendDeptNameList[0]");
System.out.println(sendDeptName);
Assert.assertEquals(sendDeptName, "西湖区营业部", network.message(params, BasicConfig.CORP_corpActivityDetail, "获取活动详情信息错误", response.body().asString()));
boolean success = response.jsonPath().getBoolean("success");
Assert.assertTrue(success, network.message(params, BasicConfig.CORP_corpActivityDetail, "获取活动详情失败", response.body().asString()));
}
@Test(description = "企业后台_上架活动", priority = 15)
public void 企业后台_上架活动() {
Map<String, Object> params = new HashMap<>();
params.put("activityId", activityId);
params.put("activityState", 2);
Response response = network.getResponse(params, BasicConfig.CORP_activityStateUpdate);
boolean data = response.jsonPath().getBoolean("data");
Assert.assertTrue(data, network.message(params, BasicConfig.CORP_activityStateUpdate, "活动上架失败", response.body().asString()));
}
@Test(description = "代理人_获取活动未读数量", priority = 16)
public void 代理人_获取活动未读数量() {
Response response = network.getResponse(BasicConfig.HOME_employeeIndexStat);
int unReadActivityNum = response.jsonPath().getInt("data.unReadActivityNum");
Assert.assertTrue(unReadActivityNum > 0, network.message(BasicConfig.HOME_employeeIndexStat, "获取未读数量错误", response.body().asString()));
}
@Test(description = "代理人_获取活动列表", priority = 17)
public void 代理人_获取活动列表() {
Map<String, Object> params = new HashMap<>();
params.put("pageIndex", 1);
params.put("pageSize", 10);
Response response = network.getResponse(params, BasicConfig.HOME_corpActivityList);
Object list = response.jsonPath().getJsonObject("data.list");
Assert.assertNotNull(list, network.message(params, BasicConfig.HOME_corpActivityList, "代理人获取活动列表失败", response.body().asString()));
}
@Test(description = "代理人_获取活动详情", priority = 18)
public void 代理人_获取活动详情() {
Map<String, Object> params = new HashMap<>();
params.put("id", activityId);
Response response = network.getResponse(params, BasicConfig.HOME_activityDetail);
//活动状态
int activityStatus = response.jsonPath().getInt("data.activityStatus");
Assert.assertEquals(activityStatus, 2, network.message(params, BasicConfig.HOME_activityDetail, "获取活动状态错误", response.body().asString()));
//完成状态
int completeResult = response.jsonPath().getInt("data.completeResult");
Assert.assertEquals(completeResult, 1, network.message(params, BasicConfig.HOME_activityDetail, "完成状态记录错误", response.body().asString()));
//上下架状态
int shelfStatus = response.jsonPath().getInt("data.shelfStatus");
Assert.assertEquals(shelfStatus, 1, network.message(params, BasicConfig.HOME_activityDetail, "上架状态记录错误", response.body().asString()));
}
@Test(description = "代理人_报名活动", priority = 19)
public void 代理人_报名活动() {
Map<String, Object> params = new HashMap<>();
params.put("id", activityId);
params.put("joinStatus", 2);//报名参加
Response response = network.postResponse(params, BasicConfig.HOME_activityJoin);
boolean data = response.jsonPath().getBoolean("data");
Assert.assertTrue(data, network.message(params, BasicConfig.HOME_activityJoin, "代理人报名参加失败", response.body().asString()));
}
@Test(description = "企业后台_新增备用账号", priority = 20)
public void 企业后台_新增备用账号() {
superUserLogin();
Map<String, Object> params = new HashMap<>();
params.put("deptId", deptId);
params.put("employeeName", "账号2");
params.put("jobNumber", "KJJ0000");
params.put("employeePhone", "15634278282");
params.put("jobPost", "业务员2");
Response response = network.postResponse(params, BasicConfig.CORP_employeeSaveOrUpdate);
boolean data = response.jsonPath().getBoolean("data");
Assert.assertTrue(data, network.message(params, BasicConfig.CORP_employeeSaveOrUpdate, "新增成员2失败", response.body().asString()));
params.clear();
params.put("deptId", testDeptId);//备用营业部
params.put("employeeName", "账号3");
params.put("jobNumber", "KJJ00000");
params.put("employeePhone", "15634278281");
params.put("jobPost", "业务员3");
Response employeeRes = network.postResponse(params, BasicConfig.CORP_employeeSaveOrUpdate);
boolean employeeData = employeeRes.jsonPath().getBoolean("data");
Assert.assertTrue(employeeData, network.message(params, BasicConfig.CORP_employeeSaveOrUpdate, "新增成员2失败", employeeRes.body().asString()));
ThreadSleepUtils.sleep(5000);
}
@Test(description = "激活备用账号2", priority = 21)
public void 激活备用账号2() {
// visitorAuth1();
userTku();
//账号2用于验证报名选择不参加
Map<String, Object> params = new HashMap<>();
params.put("corpCompanyId", "Kj20MjE1");
params.put("jobNumber", "KJJ0000");
Response response = network.postResponse(params, BasicConfig.HOME_employeeActivate);
boolean data = response.jsonPath().getBoolean("data");
Assert.assertTrue(data, network.message(params, BasicConfig.HOME_employeeActivate, "用户激活失败", response.body().asString()));
}
@Test(description = "激活备用账号3", priority = 22)
public void 激活备用账号3() {
userTku2();
//账号3用于验证非西湖区营业部的成员不能收到通知
Map<String, Object> params = new HashMap<>();
params.put("corpCompanyId", "Kj20MjE1");
params.put("jobNumber", "KJJ00000");
Response testRes = network.postResponse(params, BasicConfig.HOME_employeeActivate);
boolean testData = testRes.jsonPath().getBoolean("data");
Assert.assertTrue(testData, network.message(params, BasicConfig.HOME_employeeActivate, "用户激活失败", testRes.body().asString()));
}
@Test(description = "代理人不参加活动", priority = 23)
public void 代理人不参加活动() {
// visitorAuth1();
userTku();
Map<String, Object> detailParams = new HashMap<>();
detailParams.put("id", activityId);
Response detailRes = network.getResponse(detailParams, BasicConfig.HOME_activityDetail);
//完成状态
Object detailData = detailRes.jsonPath().getJsonObject("data");
Assert.assertNotNull(detailData, network.message(detailParams, BasicConfig.HOME_activityDetail, "查看活动失败", detailRes.body().asString()));
Map<String, Object> params = new HashMap<>();
params.put("id", activityId);
params.put("joinStatus", 3);//报名不参加
Response response = network.postResponse(params, BasicConfig.HOME_activityJoin);
boolean data = response.jsonPath().getBoolean("data");
Assert.assertTrue(data, network.message(params, BasicConfig.HOME_activityJoin, "代理人不参加失败", response.body().asString()));
}
@Test(description = "非指定营业部不收到活动", priority = 24)
public void 非指定营业部不收到活动() {
userTku2();
//未读数量为0
Response response = network.getResponse(BasicConfig.HOME_employeeIndexStat);
int unReadActivityNum = response.jsonPath().getInt("data.unReadActivityNum");
Assert.assertEquals(unReadActivityNum, 0, network.message(BasicConfig.HOME_employeeIndexStat, "非指定营业部收到活动通知", response.body().asString()));
//活动列表为空
Map<String, Object> params = new HashMap<>();
params.put("pageIndex", 1);
params.put("pageSize", 10);
Response listRes = network.getResponse(params, BasicConfig.HOME_corpActivityList);
Object list = listRes.jsonPath().getJsonObject("data.list.size()");
Assert.assertEquals(list, 0, network.message(params, BasicConfig.HOME_corpActivityList, "非指定营业部收到活动通知", listRes.body().asString()));
}
@Test(description = "企业后台_报名查看人数", priority = 25)
public void 企业后台_报名查看人数() {
Map<String, Object> params = new HashMap<>();
params.put("pageIndex", 1);
params.put("pageSize", 6);
Response listRes = network.getResponse(params, BasicConfig.CORP_corpActivityList);
int applyCount = listRes.jsonPath().getInt("data.list[0].applyCount");
Assert.assertEquals(applyCount, 1, network.message(params, BasicConfig.CORP_corpActivityList, "报名人数记录错误", listRes.body().asString()));
int checkCount = listRes.jsonPath().getInt("data.list[0].checkCount");
Assert.assertEquals(checkCount, 2, network.message(params, BasicConfig.CORP_corpActivityList, "查看人数记录错误", listRes.body().asString()));
}
@Test(description = "企业后台_下架活动", priority = 26)
public void 企业后台_下架活动() {
Map<String, Object> params = new HashMap<>();
params.put("activityId", activityId);
params.put("putawayState", 0);
Response response = network.getResponse(params, BasicConfig.CORP_putawayStateUpdate);
boolean data = response.jsonPath().getBoolean("data");
Assert.assertTrue(data, network.message(params, BasicConfig.CORP_putawayStateUpdate, "下架活动失败", response.body().asString()));
}
@Test(description = "企业后台_编辑活动", priority = 27)
public void 企业后台_编辑活动() {
Map<String, Object> params = new HashMap<>();
params.put("activityDesc", "自动化测试活动的描述-编辑");
params.put("activityName", "自动化测试活动-编辑");
params.put("id", activityId);
List activityCoverList = new ArrayList();
activityCoverList.add("https://yun.dui88.com/kjy/corp/image/20211201/1638353310973.png");
List sendDeptIdList = new ArrayList();
sendDeptIdList.add(deptId);
params.put("activityCoverList",activityCoverList);
params.put("sendDeptIdList",sendDeptIdList);
Response response = network.postResponse(params, BasicConfig.CORP_corpActivitySave);
boolean data = response.jsonPath().getBoolean("data");
Assert.assertTrue(data, network.message(params, BasicConfig.CORP_corpActivitySave, "编辑活动失败", response.body().asString()));
}
@Test(description = "代理人_查看编辑后的活动", priority = 28)
public void 代理人_查看编辑后的活动() {
visitor2Tku();
Map<String, Object> params = new HashMap<>();
params.put("id", activityId);
Response response = network.getResponse(params, BasicConfig.HOME_activityDetail);
//活动状态
int activityStatus = response.jsonPath().getInt("data.activityStatus");
Assert.assertEquals(activityStatus, 2, network.message(params, BasicConfig.HOME_activityDetail, "获取活动状态错误", response.body().asString()));
//完成状态
int completeResult = response.jsonPath().getInt("data.completeResult");
Assert.assertEquals(completeResult, 2, network.message(params, BasicConfig.HOME_activityDetail, "完成状态记录错误", response.body().asString()));
//上下架状态
int shelfStatus = response.jsonPath().getInt("data.shelfStatus");
Assert.assertEquals(shelfStatus, 0, network.message(params, BasicConfig.HOME_activityDetail, "上架状态记录错误", response.body().asString()));
//活动名称为修改后的
String activityName = response.jsonPath().getString("data.activityName");
Assert.assertEquals(activityName, "自动化测试活动-编辑", network.message(params, BasicConfig.HOME_activityDetail, "代理人获得编辑后的活动名称错误", response.body().asString()));
}
@Test(description = "企业后台_结束活动", priority = 29)
public void 企业后台_结束活动() {
Map<String, Object> params = new HashMap<>();
params.put("activityId", activityId);
params.put("activityState", 3);
Response response = network.getResponse(params, BasicConfig.CORP_activityStateUpdate);
boolean data = response.jsonPath().getBoolean("data");
Assert.assertTrue(data, network.message(params, BasicConfig.CORP_activityStateUpdate, "结束活动失败", response.body().asString()));
}
@Test(description = "代理人_查看活动结束", priority = 30)
public void 代理人_查看活动结束() {
visitor2Tku();
Map<String, Object> params = new HashMap<>();
params.put("id", activityId);
Response response = network.getResponse(params, BasicConfig.HOME_activityDetail);
//活动状态
int activityStatus = response.jsonPath().getInt("data.activityStatus");
Assert.assertEquals(activityStatus, 3, network.message(params, BasicConfig.HOME_activityDetail, "获取活动状态错误", response.body().asString()));
}
@Test(description = "企业后台_导出报表", priority = 31)
public void 企业后台_导出报表() {
Map<String, Object> params = new HashMap<>();
params.put("activityId", activityId);
Response response = network.getResponse(params, BasicConfig.CORP_activityExporte);
boolean success = response.jsonPath().getBoolean("success");
Assert.assertTrue(success, network.message(params, BasicConfig.CORP_activityExporte, "导出报表失败", response.body().asString()));
}
@Test(description = "代理人_获取客户列表", priority = 32)
public void 代理人_获取客户列表() {
Map<String, Object> params = new HashMap<>();
params.put("pageIndex", 1);
params.put("pageSize", 10);
params.put("type", 1);
Response response = network.getResponse(params, BasicConfig.HOME_customerList);
Object list = response.jsonPath().getJsonObject("data.list");
Assert.assertNotNull(list, network.message(params, BasicConfig.HOME_customerList, "获取客户列表失败", response.body().asString()));
//获取客户id
customerUserId = response.jsonPath().getJsonObject("data.list[0].customerUserId");
Assert.assertNotNull(customerUserId, network.message(params, BasicConfig.HOME_customerList, "客户ID获取失败", response.body().asString()));
}
@Test(description = "代理人_获取客户统计", priority = 33)
public void 代理人_获取客户统计() {
Response response = network.getResponse(BasicConfig.HOME_customerStatistic);
Object data = response.jsonPath().getJsonObject("data");
Assert.assertNotNull(data, network.message(BasicConfig.HOME_customerStatistic, "获取客户统计失败", response.body().asString()));
}
@Test(description = "获取直播线索失败", priority = 34)
public void 获取直播线索详情() {
//获取用户id
Map<String, Object> params = new HashMap<>();
params.put("customerUserId", customerUserId);
params.put("pageIndex", 1);
params.put("pageSize", 20);
Response clueRes = network.getResponse(params, BasicConfig.HOME_customerLiveClue);
boolean success = clueRes.jsonPath().getBoolean("success");
Assert.assertTrue(success, network.message(params, BasicConfig.HOME_customerLiveClue, "获取直播线索失败", clueRes.body().asString()));
}
//企业后台删除备用账号
@Test(description = "企业后台删除备用账号2", priority = 35)
public void 企业后台删除备用账号2() {
//获取代理人工号id
Map<String, Object> params = new HashMap<>();
params.put("pageSize", 8);
params.put("pageIndex", 1);
params.put("deptId", deptId);//备用营业部
Response infoRes = network.getResponse(params, BasicConfig.CORP_employeeList);
String employeeId = infoRes.jsonPath().getString("data.list[0].id");
//企业后台删除代理人工号
Map<String, Object> delParams = new HashMap<>();
delParams.put("id", employeeId);
Response delRes = network.postResponse(delParams, BasicConfig.CORP_employeeDel);
boolean empData = delRes.jsonPath().getBoolean("data");
Assert.assertTrue(empData, network.message(params, BasicConfig.CORP_employeeDel, "删除备用成员2失败", delRes.body().asString()));
}
@Test(description = "企业后台删除备用账号3", priority = 36)
public void 企业后台删除备用账号3() {
//获取代理人工号id
Map<String, Object> params = new HashMap<>();
params.put("pageSize", 8);
params.put("pageIndex", 1);
params.put("deptId", testDeptId);//备用营业部
Response infoRes = network.getResponse(params, BasicConfig.CORP_employeeList);
String employeeId = infoRes.jsonPath().getString("data.list[0].id");
//企业后台删除代理人工号
Map<String, Object> delParams = new HashMap<>();
delParams.put("id", employeeId);
Response delRes = network.postResponse(delParams, BasicConfig.CORP_employeeDel);
boolean empData = delRes.jsonPath().getBoolean("data");
Assert.assertTrue(empData, network.message(params, BasicConfig.CORP_employeeDel, "删除备用成员3失败", delRes.body().asString()));
}
@Test(description = "删除代理人账号权限变为个人版", priority = 37)
public void 删除代理人工号权限变为个人版() {
//获取代理人工号id
Map<String, Object> params = new HashMap<>();
params.put("pageSize", 8);
params.put("pageIndex", 1);
params.put("deptId", deptId);//西湖区营业部
Response infoRes = network.getResponse(params, BasicConfig.CORP_employeeList);
Object employeeId = infoRes.jsonPath().getJsonObject("data.list[0].id");
//企业后台删除代理人工号
Map<String, Object> delParams = new HashMap<>();
delParams.put("id", employeeId);
Response delRes = network.postResponse(delParams, BasicConfig.CORP_employeeDel);
boolean empData = delRes.jsonPath().getBoolean("data");
Assert.assertTrue(empData, network.message(params, BasicConfig.CORP_employeeDel, "删除成员失败", delRes.body().asString()));
//代理人权限为个人版
Response response = network.getResponse(BasicConfig.HOME_employeeAuth);
int authType = response.jsonPath().getInt("data.authType");
Assert.assertEquals(authType, 1, network.message(BasicConfig.HOME_employeeAuth, "获取用户权限错误", response.body().asString()));
}
@Test(description = "企业后台_新增账号", priority = 38)
public void 企业后台_新增账号() {
superUserLogin();
Map<String, Object> params = new HashMap<>();
params.put("deptId", deptId);//西湖区营业部
params.put("employeeName", "张三");
params.put("jobNumber", "KJJ000");
params.put("employeePhone", "15634278283");
params.put("jobPost", "业务员");
Response response = network.postResponse(params, BasicConfig.CORP_employeeSaveOrUpdate);
boolean data = response.jsonPath().getBoolean("data");
Assert.assertTrue(data, network.message(params, BasicConfig.CORP_employeeSaveOrUpdate, "新增成员失败", response.body().asString()));
}
}
...@@ -1232,7 +1232,7 @@ public class BasicConfig { ...@@ -1232,7 +1232,7 @@ public class BasicConfig {
public static final String CORP_putawayStateUpdate = CORP_HOST + "/kjy/corp/activity/putaway/state/update"; public static final String CORP_putawayStateUpdate = CORP_HOST + "/kjy/corp/activity/putaway/state/update";
public static final String CORP_activityExporte = CORP_HOST + "/kjy/corp/activity/export"; public static final String CORP_activityExporte = CORP_HOST + "/kjy/corp/activity/export";
//企业版代理人 //企业版代理人
public static final String HOME_employeeActivateCheck = HOST +"/kjy/corp/employee/activateCheck";
public static final String HOME_employeeActivate = HOST + "/kjy/corp/employee/activate"; public static final String HOME_employeeActivate = HOST + "/kjy/corp/employee/activate";
public static final String HOME_corpCompanyInfo = HOST + "/kjy/corp/company/info"; public static final String HOME_corpCompanyInfo = HOST + "/kjy/corp/company/info";
public static final String HOME_employeeAuth = HOST + "/kjy/corp/employee/auth"; public static final String HOME_employeeAuth = HOST + "/kjy/corp/employee/auth";
......
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