Commit 3791741e authored by Su-Yi's avatar Su-Yi

修改tku

parent af4a6b7a
......@@ -2,6 +2,7 @@ package com.kjj.qa.cases;
import static com.kjj.qa.config.BasicConfig.*;
import com.kjj.qa.utils.NetworkUtil;
import io.restassured.http.Cookies;
import io.restassured.response.Response;
import org.testng.Assert;
import org.testng.annotations.*;
......@@ -227,10 +228,34 @@ public class Pay {
}
@AfterClass
public static void tearDown(){
public static void tearDown() throws IOException{
apiCount += 9;
}
//切换vip
private static void switchvip() {
// 拿到sellerId
Response response = network.getResponse(USER_INFO);
String sellerId = response.jsonPath().getString("data.sellerId");
//1.先进入SSO登录框 登入管理后台
network.host = SSO_HOST;
Map<String, Object> loginParams = new HashMap<String, Object>();
loginParams.put("email","lihaohong");
loginParams.put("password","duiba123456");
loginParams.put("loginTimeout",1);
loginParams.put("redirect","https://kjj-mng.duibatest.com.cn");
loginParams.put("systemId",201);
response = network.postResponse(loginParams,SSO_DOLOGIN);
Cookies cookies = response.getDetailedCookies();
System.out.println(cookies);
// 2.登录成功,切到管理后台
// network.host = MANAGER_HOST;
}
}
......
......@@ -10,7 +10,7 @@ public class BasicConfig {
// 用户微信昵称
public static final String WECHAT_NAME = "小疙瘩人寿"; //
// 用户tku
public static final String AGENT_TKU = "T3gM31f18jAW2wRySqh6tHAzQDB2z1DmVbnGZCgtRFRnuyDa1un8sPGtpzN2yChmKZkaHJv26BHEEfMcWs";
public static final String AGENT_TKU = "T3gM31f18jAW2M6V9AZyhvzbbFXDBHGsiNS6yVm6DcRXUWGczEYsdCgHpSH9Ut6tb1isdesvNjkKd5nuno";
// *************** 钉钉机器人 ***************
// 线上-告警群
......@@ -20,7 +20,12 @@ public class BasicConfig {
;
// *************** 客集集域名 ***************
public static final String HOST = "https://kjj.m.duibatest.com.cn"; // "https://kjj.m.duiba.com.cn";
public static final String HOST = "https://kjj.m.duibatest.com.cn";
public static final String SSO_HOST = "https://sso.duibatest.com.cn";
public static final String MANAGER_HOST = "https://kjj-mng.duibatest.com.cn";
// *************** TKU ***************
public static final String VISITOR_TKU = "T3gM31f18jAW2hicRDxbwHFSuwA4MMVLLeHZ5G4yvb3kN3PcWwcLdzfxPp2gghfE4x3BFH8JN3f8PUzQ6W";
......@@ -209,7 +214,12 @@ public class BasicConfig {
public static final String BOSS_MEMBER = "/kjy/mp/seller/team/member";
// 管理后台
public static final String SSO_DOLOGIN = "/doLogin";
public static final String SSO_INDEX = "/sso/ssoIndex";
public static final String MANAGER_AUTH = "/auth/getAuthList";
......
......@@ -3,9 +3,11 @@ import static com.kjj.qa.config.BasicConfig.*;
import static io.restassured.RestAssured.*;
import com.alibaba.fastjson.JSONObject;
import io.restassured.http.Cookies;
import io.restassured.response.Response;
import java.io.File;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
......@@ -22,9 +24,13 @@ public class NetworkUtil {
public void setAgentHeaders(Map<String, Object> agentHeaders) { this.agentHeaders = agentHeaders; }
public Map<String, Object> fileHeaders = new HashMap<String, Object>();
public Map<String, Object> getFileHeaders() { return agentHeaders; }
public Map<String, Object> getFileHeaders() { return fileHeaders; }
public void setFileHeadersHeaders(Map<String, Object> fileHeaders) { this.fileHeaders = fileHeaders; }
public String host = "";
public String getHost() {return host;}
public void setHost(String host) {this.host = host;}
// 钉钉的 headers
public Map<String, Object> dingTalkHeaders = new HashMap<String, Object>();
public Map<String, Object> getDingTalkHeaders() { return dingTalkHeaders; }
......@@ -34,6 +40,8 @@ public class NetworkUtil {
// 构造函数 初始化tku、content-type
private NetworkUtil (){
//配置地址
host = HOST;
//cookies中的tku
agentCookies.put("tku",AGENT_TKU);
//json类型的headers
......@@ -65,7 +73,7 @@ public class NetworkUtil {
return given()
.cookies(agentCookies)
.headers(agentHeaders)
.get(HOST + path);
.get(host + path);
}
// get 带参请求
......@@ -74,7 +82,7 @@ public class NetworkUtil {
.cookies(agentCookies)
.headers(agentHeaders)
.params(params)
.get(HOST + path);
.get(host + path);
}
// post 不帶参请求
......@@ -82,7 +90,7 @@ public class NetworkUtil {
return given()
.cookies(agentCookies)
.headers(agentHeaders)
.post(HOST + path);
.post(host + path);
}
// post 带参请求
......@@ -92,7 +100,7 @@ public class NetworkUtil {
.cookies(agentCookies)
.headers(agentHeaders)
.body(jsonStr)
.post(HOST + path);
.post(host + path);
}
// post 文件上传
......@@ -101,7 +109,7 @@ public class NetworkUtil {
.cookies(agentCookies)
.headers(fileHeaders)
.multiPart("file",new File(filePath))
.post(HOST + path);
.post(host + path);
}
// post 钉钉机器人
......@@ -127,8 +135,9 @@ public class NetworkUtil {
}
public static void main(String[] args) {
public static void main(String[] args) throws IOException {
}
}
This source diff could not be displayed because it is too large. You can view the blob instead.
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