Commit 8f1e680c by zhangying

新增10个case

parent 85164ec8
......@@ -42,7 +42,7 @@ public class TestMultiPartUpload extends XMBaseTest {
bodyMap.put("accessTypeEnum", "PUBLIC");
bodyMap.put("bizCode", "UPLOAD_FOLDER");
bodyMap.put("data", contentMap);
bodyMap.put("instId", "1235115978015883266");
bodyMap.put("instId", xmAppApi.getLoginInfo().getInstId());
bodyMap.put("resourceName", "XWX8GXcwRaHmicrZ.pptx");
System.out.println("bodyMap = "+bodyMap);
......
......@@ -5,6 +5,7 @@ import com.live.enums.ApiModele;
import com.live.enums.RequestType;
import com.live.enums.Terminal;
import com.live.utils.XMBaseTest;
import com.live.xmutils.GetFolderData;
import org.testng.Assert;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
......@@ -29,13 +30,19 @@ public class TestSameNameFile extends XMBaseTest {
* 资料云盘-同名文件查询
*/
@Test
public void testSameNameFile() {
public void testSameNameFile() throws InterruptedException {
GetFolderData getFolderData = new GetFolderData();
JSONObject folder = getFolderData.saveFolder(); //新增文件数据,以免存量数据不足导致运行报错
JSONObject folderList = getFolderData.getCommonFolderList();
System.out.println("folderList =="+ folderList);
String folderName = folderList.getJSONObject("result").getJSONArray("records").getJSONObject(0).getString("folderName");
JSONObject jsonObject = new JSONObject();
jsonObject.put("disk","COMMON");
jsonObject.put("folderType","FOLDER");
jsonObject.put("instId","1235115978015883266");
jsonObject.put("name","zy自动化测试文件夹1");
jsonObject.put("instId",xmAppApi.getLoginInfo().getInstId());
jsonObject.put("name",folderName);
System.out.println("jsonObject ="+jsonObject );
xmAppApi.doRequest(RequestType.JSON, params, jsonObject.toJSONString(), headers);
......@@ -43,7 +50,7 @@ public class TestSameNameFile extends XMBaseTest {
JSONObject jsonBody = xmAppApi.getBodyInJSON();
System.out.println("jsonBody ="+jsonBody);
Assert.assertEquals(jsonBody.getJSONObject("result").getString("folderName"),"zy自动化测试文件夹1");
Assert.assertEquals(jsonBody.getJSONObject("result").getString("folderName"),folderName);
Assert.assertEquals("true", jsonBody.getString("success"));
Assert.assertEquals("200", jsonBody.getString("code"));
Assert.assertEquals("操作成功!", jsonBody.getString("message"));
......
package com.live.cases.fileManage.myselfFolder;
import com.alibaba.fastjson.JSONObject;
import com.live.enums.ApiModele;
import com.live.enums.RequestType;
import com.live.enums.Terminal;
import com.live.utils.XMBaseTest;
import com.live.xmutils.GetFolderData;
import org.testng.Assert;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import java.util.ArrayList;
import java.util.List;
/**
* @Description 删除公共文件列表的文件
* @author zhangying
*/
public class TestDelSelfFolder extends XMBaseTest {
@BeforeMethod
public void beforeTest(){
xmAppApi.setApiModule(ApiModele.CloudClass_File )
.setApiName("API_delCommomFolder")
.setLoginUser("zhangy-b") //张莹的机构里文件夹数据比较多,所以这里用她的测删除文件夹
.setTerminal(Terminal.B);
super.beforeTest();
}
@Test(description = "删除单个文件")
public void testDelSelfFolder() throws InterruptedException {
GetFolderData testCommonFolderList = new GetFolderData();
JSONObject folderList = testCommonFolderList.getFolderList();
String id = folderList.getJSONObject("result").getJSONArray("records").getJSONObject(0).getString("id");
System.out.println("获取id" + id);
JSONObject jsonObject = new JSONObject();
List StringList = new ArrayList();
StringList.add(id);
jsonObject.put("ids", StringList);
jsonObject.put("instId","1300628703858597889");
System.out.println("请求" + jsonObject);
xmAppApi.doRequest(RequestType.JSON,params,jsonObject.toJSONString(),headers).assetsSuccess(true);
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);
}
@Test(description = "批量删除多个文件")
public void testDelSelfFolder1() throws InterruptedException {
GetFolderData testCommonFolderList = new GetFolderData();
JSONObject folderList = testCommonFolderList.getFolderList();
System.out.println("folderList =="+folderList);
String folderId = folderList.getJSONObject("result").getJSONArray("records").getJSONObject(0).getString("id");
String folderId1 = folderList.getJSONObject("result").getJSONArray("records").getJSONObject(1).getString("id");
JSONObject jsonObject = new JSONObject();
List StringList = new ArrayList();
StringList.add(folderId);
StringList.add(folderId1);
jsonObject.put("ids", StringList);
jsonObject.put("instId","1300628703858597889");
System.out.println("请求" + jsonObject);
xmAppApi.doRequest(RequestType.JSON,params,jsonObject.toJSONString(),headers).assetsSuccess(true);
JSONObject responseRes = xmAppApi.getBodyInJSON();
JSONObject folderList1 = testCommonFolderList.getCommonFolderList();
String id = folderList1.getJSONObject("result").getJSONArray("records").getJSONObject(0).getString("id");
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(folderId, id);
Assert.assertNotEquals(folderId1, id1);
}
}
......@@ -35,8 +35,8 @@ public class TestMoveFolder extends XMBaseTest {
public void testMoveFolder() {
GetFolderData getFolderData = new GetFolderData();
JSONObject folderList = getFolderData.getFolderList();
JSONObject folder = getFolderData.saveMyselfFolder(); //新增文件数据,以免存量数据不足导致运行报错
JSONObject folderList = getFolderData.getFolderList();
String folderId = folderList.getJSONObject("result").getJSONArray("records").getJSONObject(0).getString("id");
......
package com.live.cases.fileManage.myselfFolder;
import com.alibaba.fastjson.JSONObject;
import com.live.enums.ApiModele;
import com.live.enums.RequestType;
import com.live.enums.Terminal;
import com.live.utils.XMBaseTest;
import com.live.xmutils.GetFolderData;
import org.testng.Assert;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
/**
* Created by zhangying on 2020/04/08
*/
public class TestSameNameSelfFile extends XMBaseTest {
@BeforeMethod
public void beforeTest() {
xmAppApi.setApiModule(ApiModele.CloudClass_apollo) // API 所属模块 必传 读取配置文件config.properties配置的api地址
.setApiName("API_sameNameFile") // API 名称 必传
.setLoginUser("zhangy-b") // http 接口,测试账号 必传
.setTerminal(Terminal.B); // 所属端位(B端,C端,M端等, 必传)
dal.setCase_owner("张莹");
super.beforeTest();
}
/**
* 资料云盘-同名文件查询
*/
@Test
public void testSameNameSelfFile() {
GetFolderData getFolderData = new GetFolderData();
JSONObject folder = getFolderData.saveMyselfFolder(); //新增文件数据,以免存量数据不足导致运行报错
JSONObject folderList = getFolderData.getFolderList();
System.out.println("folderList =="+ folderList);
String folderName = folderList.getJSONObject("result").getJSONArray("records").getJSONObject(0).getString("folderName");
JSONObject jsonObject = new JSONObject();
jsonObject.put("disk","MYSELF");
jsonObject.put("folderType","FOLDER");
jsonObject.put("instId",xmAppApi.getLoginInfo().getInstId());
jsonObject.put("name",folderName);
System.out.println("jsonObject ="+jsonObject );
xmAppApi.doRequest(RequestType.JSON, params, jsonObject.toJSONString(), headers);
System.out.println(xmAppApi);
JSONObject jsonBody = xmAppApi.getBodyInJSON();
System.out.println("jsonBody ="+jsonBody);
Assert.assertEquals(jsonBody.getJSONObject("result").getString("folderName"),folderName);
Assert.assertEquals("true", jsonBody.getString("success"));
Assert.assertEquals("200", jsonBody.getString("code"));
Assert.assertEquals("操作成功!", jsonBody.getString("message"));
}
}
package com.live.cases.fileManage.myselfFolder;
import com.alibaba.fastjson.JSONObject;
import com.live.enums.ApiModele;
import com.live.enums.RequestType;
import com.live.enums.Terminal;
import com.live.utils.XMBaseTest;
import org.testng.Assert;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
/**
* @Description 文件列表,公共文件
* @author zhangyumeng
*/
public class TestSelfFolderList extends XMBaseTest {
@BeforeMethod
public void beforeTest(){
xmAppApi.setApiModule(ApiModele.CloudClass_B )
.setApiName("API_commonFolderList")
.setLoginUser("zhangy-b") //张莹的账号下数据比较多
.setTerminal(Terminal.B);
dal.setCase_owner("张莹/张雨朦");
super.beforeTest();
}
@Test(description = "获取公共文件列表")
public void testSelfFolderList(){
JSONObject jsonObject = new JSONObject();
//jsonObject.put("bizAccountId","1323235986786807809");
jsonObject.put("current",1);
jsonObject.put("disk", "COMMON");
jsonObject.put("folderIdType", "FOLDER");
jsonObject.put("instId",xmAppApi.getLoginInfo().getInstId());
jsonObject.put("searchName", null);
jsonObject.put("size", 10);
System.out.println("请求" + jsonObject);
xmAppApi.doRequest(RequestType.JSON,params,jsonObject.toJSONString(),headers);
JSONObject responseRes = xmAppApi.getBodyInJSON();
Assert.assertEquals("true",responseRes.getString("success"));
}
@Test(description = "公共文件列表,按名称降序排序")
public void testSelfFolderList1(){
JSONObject jsonObject = new JSONObject();
jsonObject.put("current",1);
jsonObject.put("disk", "COMMON");
jsonObject.put("folderIdType", "FOLDER");
jsonObject.put("instId",xmAppApi.getLoginInfo().getInstId());
jsonObject.put("searchName", null);
jsonObject.put("size", 10);
jsonObject.put("sort", "NAME_DESC");
jsonObject.put("parentId", null);
System.out.println("请求" + jsonObject);
xmAppApi.doRequest(RequestType.JSON,params,jsonObject.toJSONString(),headers);
JSONObject responseRes = xmAppApi.getBodyInJSON();
System.out.println("responseRes =="+responseRes );
Assert.assertEquals("true",responseRes.getString("success"));
Assert.assertNotNull(responseRes.getJSONObject("result").getString("total"));
}
@Test(description = "公共文件列表,按名称升序排序")
public void testSelfFolderList2(){
JSONObject jsonObject = new JSONObject();
jsonObject.put("current",1);
jsonObject.put("disk", "COMMON");
jsonObject.put("folderIdType", "FOLDER");
jsonObject.put("instId",xmAppApi.getLoginInfo().getInstId());
jsonObject.put("searchName", null);
jsonObject.put("size", 10);
jsonObject.put("sort", "NAME_ASC");
jsonObject.put("parentId", null);
System.out.println("请求" + jsonObject);
xmAppApi.doRequest(RequestType.JSON,params,jsonObject.toJSONString(),headers);
JSONObject responseRes = xmAppApi.getBodyInJSON();
System.out.println("responseRes =="+responseRes );
Assert.assertEquals("true",responseRes.getString("success"));
Assert.assertNotNull(responseRes.getJSONObject("result").getString("total"));
}
@Test(description = "公共文件列表,按更新时间升序排序")
public void testSelfFolderList3(){
JSONObject jsonObject = new JSONObject();
jsonObject.put("current",1);
jsonObject.put("disk", "COMMON");
jsonObject.put("folderIdType", "FOLDER");
jsonObject.put("instId",xmAppApi.getLoginInfo().getInstId());
jsonObject.put("searchName", null);
jsonObject.put("size", 10);
jsonObject.put("sort", "UPDATE_ASC");
jsonObject.put("parentId", null);
System.out.println("请求" + jsonObject);
xmAppApi.doRequest(RequestType.JSON,params,jsonObject.toJSONString(),headers);
JSONObject responseRes = xmAppApi.getBodyInJSON();
System.out.println("responseRes =="+responseRes );
Assert.assertEquals("true",responseRes.getString("success"));
Assert.assertNotNull(responseRes.getJSONObject("result").getString("total"));
}
@Test(description = "公共文件列表,按更新时间降序排序")
public void testSelfFolderList4(){
JSONObject jsonObject = new JSONObject();
jsonObject.put("current",1);
jsonObject.put("disk", "COMMON");
jsonObject.put("folderIdType", "FOLDER");
jsonObject.put("instId",xmAppApi.getLoginInfo().getInstId());
jsonObject.put("searchName", null);
jsonObject.put("size", 10);
jsonObject.put("sort", "UPDATE_DESC");
jsonObject.put("parentId", null);
System.out.println("请求" + jsonObject);
xmAppApi.doRequest(RequestType.JSON,params,jsonObject.toJSONString(),headers);
JSONObject responseRes = xmAppApi.getBodyInJSON();
System.out.println("responseRes =="+responseRes );
Assert.assertEquals("true",responseRes.getString("success"));
Assert.assertNotNull(responseRes.getJSONObject("result").getString("total"));
}
@Test(description = "公共文件列表,按文件大小升序排序")
public void testSelfFolderList5(){
JSONObject jsonObject = new JSONObject();
jsonObject.put("current",1);
jsonObject.put("disk", "COMMON");
jsonObject.put("folderIdType", "FOLDER");
jsonObject.put("instId",xmAppApi.getLoginInfo().getInstId());
jsonObject.put("searchName", null);
jsonObject.put("size", 10);
jsonObject.put("sort", "SIZE_ASC");
jsonObject.put("parentId", null);
System.out.println("请求" + jsonObject);
xmAppApi.doRequest(RequestType.JSON,params,jsonObject.toJSONString(),headers);
JSONObject responseRes = xmAppApi.getBodyInJSON();
System.out.println("responseRes =="+responseRes );
Assert.assertEquals("true",responseRes.getString("success"));
Assert.assertNotNull(responseRes.getJSONObject("result").getString("total"));
}
@Test(description = "公共文件列表,按文件大小降序排序")
public void testSelfFolderList6(){
JSONObject jsonObject = new JSONObject();
jsonObject.put("current",1);
jsonObject.put("disk", "COMMON");
jsonObject.put("folderIdType", "FOLDER");
jsonObject.put("instId",xmAppApi.getLoginInfo().getInstId());
jsonObject.put("searchName", null);
jsonObject.put("size", 10);
jsonObject.put("sort", "SIZE_DESC");
jsonObject.put("parentId", null);
System.out.println("请求" + jsonObject);
xmAppApi.doRequest(RequestType.JSON,params,jsonObject.toJSONString(),headers);
JSONObject responseRes = xmAppApi.getBodyInJSON();
System.out.println("responseRes =="+responseRes );
Assert.assertEquals("true",responseRes.getString("success"));
Assert.assertNotNull(responseRes.getJSONObject("result").getString("total"));
}
}
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