Commit aee8a44e by zhangying

review

parent e5d6798b
...@@ -6,6 +6,7 @@ import com.live.enums.ApiModele; ...@@ -6,6 +6,7 @@ import com.live.enums.ApiModele;
import com.live.enums.RequestType; import com.live.enums.RequestType;
import com.live.enums.Terminal; import com.live.enums.Terminal;
import com.live.utils.XMBaseTest; import com.live.utils.XMBaseTest;
import org.testng.Assert;
import org.testng.annotations.BeforeMethod; import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test; import org.testng.annotations.Test;
...@@ -27,10 +28,11 @@ public class TestDelCommonFolder extends XMBaseTest { ...@@ -27,10 +28,11 @@ public class TestDelCommonFolder extends XMBaseTest {
super.beforeTest(); super.beforeTest();
} }
@Test(enabled = false) @Test
public void testDelCommonFolderList(){ public void testDelCommonFolderList() throws InterruptedException {
GetFolderData testCommonFolderList = new GetFolderData(); GetFolderData testCommonFolderList = new GetFolderData();
String id = testCommonFolderList.getCommonFolderListFirstId(); JSONObject folderList = testCommonFolderList.getCommonFolderList();
String id = folderList.getJSONObject("result").getJSONArray("records").getJSONObject(0).getString("id");
System.out.println("获取id" + id); System.out.println("获取id" + id);
JSONObject jsonObject = new JSONObject(); JSONObject jsonObject = new JSONObject();
...@@ -41,8 +43,15 @@ public class TestDelCommonFolder extends XMBaseTest { ...@@ -41,8 +43,15 @@ public class TestDelCommonFolder extends XMBaseTest {
System.out.println("请求" + jsonObject); System.out.println("请求" + jsonObject);
xmAppApi.doRequest(RequestType.JSON,params,jsonObject.toJSONString(),headers).assetsSuccess(true); xmAppApi.doRequest(RequestType.JSON,params,jsonObject.toJSONString(),headers).assetsSuccess(true);
JSONObject responseRes = xmAppApi.getBodyInJSON(); JSONObject responseRes = xmAppApi.getBodyInJSON();
JSONObject folderList1 = testCommonFolderList.getCommonFolderList();
String id1 = folderList1.getJSONObject("result").getJSONArray("records").getJSONObject(0).getString("id");
System.out.println("id1 == "+id1);
Assert.assertEquals("true", responseRes.getString("success"));
Assert.assertEquals("200", responseRes.getString("code"));
Assert.assertNotEquals(id1, id);
} }
} }
...@@ -17,7 +17,7 @@ public class TestGetFileUserAuthority extends XMBaseTest { ...@@ -17,7 +17,7 @@ public class TestGetFileUserAuthority extends XMBaseTest {
@BeforeMethod @BeforeMethod
public void beforeTest() { public void beforeTest() {
xmAppApi.setApiModule(ApiModele.CloudClass_apollo) // API 所属模块 必传 读取配置文件config.properties配置的api地址 xmAppApi.setApiModule(ApiModele.CloudClass_File) // API 所属模块 必传 读取配置文件config.properties配置的api地址
.setApiName("API_getFileUserAuthority") // API 名称 必传 .setApiName("API_getFileUserAuthority") // API 名称 必传
.setLoginUser("zhangy-b") // http 接口,测试账号 必传 .setLoginUser("zhangy-b") // http 接口,测试账号 必传
.setTerminal(Terminal.B); // 所属端位(B端,C端,M端等, 必传) .setTerminal(Terminal.B); // 所属端位(B端,C端,M端等, 必传)
......
...@@ -8,53 +8,40 @@ import com.live.utils.RandomStringUtil; ...@@ -8,53 +8,40 @@ import com.live.utils.RandomStringUtil;
import com.live.utils.XMBaseTest; import com.live.utils.XMBaseTest;
import io.restassured.response.Response; import io.restassured.response.Response;
import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.concurrent.TimeUnit;
import static io.restassured.RestAssured.given; import static io.restassured.RestAssured.given;
public class GetFolderData extends XMBaseTest { public class GetFolderData extends XMBaseTest {
public Response saveFolder() { public String saveFolder() {
dataApi.setApiModule(ApiModele.CloudClass_File) // API 所属模块 必传 读取配置文件config.properties配置的api地址 dataApi.setApiModule(ApiModele.CloudClass_File) // API 所属模块 必传 读取配置文件config.properties配置的api地址
.setApiName("API_saveFolder") // API 名称 必传 .setApiName("API_saveFolder") // API 名称 必传
.setEnv("prod") // 运行环境 测试时可指定自己要运行的环境。 不穿默认取系统指定的允许环境
.setLoginUser("zhangy-b") // http 接口,测试账号 必传 .setLoginUser("zhangy-b") // http 接口,测试账号 必传
.setTerminal(Terminal.B); // 所属端位(B端,C端,M端等, 必传) .setTerminal(Terminal.B); // 所属端位(B端,C端,M端等, 必传)
// dal.setCase_owner("zhangying")
// .setCase_name(Thread.currentThread().getStackTrace()[1].getFileName().split("\\.")[0]);
super.beforeTest(); super.beforeTest();
String name = "测试文件夹新增"+ RandomStringUtil.randomString(6); //评分维度名称 String name = "测试文件夹新增"+ RandomStringUtil.randomString(6); //新增文件夹名称
JSONObject jsonObject = new JSONObject();
Map bodyMap = new HashMap(); jsonObject.put("createUser", "ADMIN");
bodyMap.put("createUser", "ADMIN"); jsonObject.put("disk", "COMMON");
bodyMap.put("disk", "MYSELF"); jsonObject.put("folderTypeEnum", "FOLDER");
bodyMap.put("folderTypeEnum", "FOLDER"); jsonObject.put("instId", "1235115978015883266");
bodyMap.put("instId", "1235115978015883266"); jsonObject.put("name", name);
bodyMap.put("name", name); jsonObject.put("parentId", null);
bodyMap.put("parentId", null);
String bodydata = JSONObject.toJSONString(bodyMap);
// 接口请求 返回responseBody dataApi.doRequest(RequestType.JSON, params, jsonObject.toJSONString(), headers);
Response response = given() System.out.println(dataApi);
.header("Content-Type", "application/json") JSONObject jsonBody = dataApi.getBodyInJSON();
.queryParams(params) System.out.println("新增文件夹返回值 jsonBody =="+jsonBody);
.headers(headers) String folderId = jsonBody.getString("result");
.body(bodydata) System.out.println("folder =="+folderId);
.when()
.post(dataApi.getUrl())
.then().log().all()
.extract()
.path("result");
return response; return folderId;
} }
/** /**
...@@ -75,7 +62,6 @@ public class GetFolderData extends XMBaseTest { ...@@ -75,7 +62,6 @@ public class GetFolderData extends XMBaseTest {
jsonObject.put("current", 1); jsonObject.put("current", 1);
jsonObject.put("size", 10); jsonObject.put("size", 10);
jsonObject.put("disk", "MYSELF"); jsonObject.put("disk", "MYSELF");
// String jsonObject = JSONObject.toJSONString(jsonObject);
dataApi.doRequest(RequestType.JSON, params, jsonObject.toJSONString(), headers); dataApi.doRequest(RequestType.JSON, params, jsonObject.toJSONString(), headers);
...@@ -88,7 +74,7 @@ public class GetFolderData extends XMBaseTest { ...@@ -88,7 +74,7 @@ public class GetFolderData extends XMBaseTest {
/** /**
* 资料云盘-公共文件 * 资料云盘-公共文件
*/ */
public JSONObject getCommonFolderList() { public JSONObject getCommonFolderList() throws InterruptedException {
dataApi.setApiModule(ApiModele.CloudClass_File) // API 所属模块 必传 读取配置文件config.properties配置的api地址 dataApi.setApiModule(ApiModele.CloudClass_File) // API 所属模块 必传 读取配置文件config.properties配置的api地址
.setApiName("API_folderList") // API 名称 必传 .setApiName("API_folderList") // API 名称 必传
...@@ -104,14 +90,42 @@ public class GetFolderData extends XMBaseTest { ...@@ -104,14 +90,42 @@ public class GetFolderData extends XMBaseTest {
jsonObject.put("size", 10); jsonObject.put("size", 10);
jsonObject.put("disk", "COMMON"); jsonObject.put("disk", "COMMON");
jsonObject.put("folderIdType", "FOLDER"); jsonObject.put("folderIdType", "FOLDER");
jsonObject.put("instId", "1235115978015883266"); jsonObject.put("instId", xmAppApi.getLoginInfo().getInstId());
// jsonObject.put("searchName", "null");
// String jsonObject = JSONObject.toJSONString(jsonObject);
dataApi.doRequest(RequestType.JSON, params, jsonObject.toJSONString(), headers);
System.out.println(dataApi);
JSONObject jsonBody = dataApi.getBodyInJSON();
TimeUnit.SECONDS.sleep(3);
return jsonBody;
}
/**
* 资料云盘-公共文件-权限管理-员工列表
*/
public JSONObject getFileUserAuthority() throws InterruptedException {
dataApi.setApiModule(ApiModele.CloudClass_File) // API 所属模块 必传 读取配置文件config.properties配置的api地址
.setApiName("API_getFileUserAuthority") // API 名称 必传
.setLoginUser("zhangy-b") // http 接口,测试账号 必传
.setTerminal(Terminal.B); // 所属端位(B端,C端,M端等, 必传)
super.beforeDataRequest();
GetFolderData testSaveFolder = new GetFolderData();
String folderId = testSaveFolder.saveFolder();
JSONObject jsonObject = new JSONObject();
jsonObject.put("id",folderId);
jsonObject.put("instId", xmAppApi.getLoginInfo().getInstId());
dataApi.doRequest(RequestType.JSON, params, jsonObject.toJSONString(), headers); dataApi.doRequest(RequestType.JSON, params, jsonObject.toJSONString(), headers);
System.out.println(dataApi); System.out.println(dataApi);
JSONObject jsonBody = dataApi.getBodyInJSON(); JSONObject jsonBody = dataApi.getBodyInJSON();
TimeUnit.SECONDS.sleep(3);
return jsonBody; return jsonBody;
} }
...@@ -129,7 +143,7 @@ public class GetFolderData extends XMBaseTest { ...@@ -129,7 +143,7 @@ public class GetFolderData extends XMBaseTest {
jsonObject.put("current",1); jsonObject.put("current",1);
jsonObject.put("disk", "COMMON"); jsonObject.put("disk", "COMMON");
jsonObject.put("folderIdType", "FOLDER"); jsonObject.put("folderIdType", "FOLDER");
jsonObject.put("instId","1300628703858597889"); jsonObject.put("instId",xmAppApi.getLoginInfo().getInstId());
jsonObject.put("searchName", null); jsonObject.put("searchName", null);
jsonObject.put("size", 10); jsonObject.put("size", 10);
......
...@@ -103,5 +103,11 @@ ...@@ -103,5 +103,11 @@
"apiContentType": "application/json;charset=UTF-8", "apiContentType": "application/json;charset=UTF-8",
"apiName": "修改文件夹成员权限", "apiName": "修改文件夹成员权限",
"desc": "修改文件夹成员权限" "desc": "修改文件夹成员权限"
},
"API_getFileUserAuthority": {
"apiPath": "/apollo/public/apollo/getFileUserAuthority",
"apiContentType": "application/json;charset=utf-8",
"apiName": "公共文件权限管理",
"desc": "公共文件权限管理"
} }
} }
...@@ -155,12 +155,6 @@ ...@@ -155,12 +155,6 @@
"apiName": "查询同名文件", "apiName": "查询同名文件",
"desc": "查询同名文件" "desc": "查询同名文件"
}, },
"API_getFileUserAuthority": {
"apiPath": "/apollo/public/apollo/getFileUserAuthority",
"apiContentType": "application/json;charset=utf-8",
"apiName": "公共文件权限管理",
"desc": "公共文件权限管理"
},
"API_getFileUser": { "API_getFileUser": {
"apiPath": "/apollo/public/apollo/getFileUser", "apiPath": "/apollo/public/apollo/getFileUser",
"apiContentType": "application/json;charset=utf-8", "apiContentType": "application/json;charset=utf-8",
......
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