Commit a54a60e0 by xyy

fix case

parent d742037e
package com.xiaomai.cases.polar.brandMerchant;
import com.alibaba.fastjson.JSONObject;
import com.xiaomai.cases.polar.studioConfig.MerchantTools;
import com.xiaomai.enums.ApiModule;
import com.xiaomai.enums.LoginAccount;
import com.xiaomai.enums.RequestType;
......@@ -11,6 +12,8 @@ import org.testng.Assert;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import javax.annotation.Resource;
/**
* @Author: xyy
* @CreateTime: 2024-04-23 11:48
......@@ -19,6 +22,9 @@ import org.testng.annotations.Test;
*/
public class TestGetApply extends XMBaseTest {
@Resource(name = "merchantTools")
MerchantTools merchantTools;
@BeforeMethod
public void beforeTest(){
xmAppApi.setApiModule(ApiModule.Polar_Merchant)
......@@ -31,13 +37,28 @@ public class TestGetApply extends XMBaseTest {
}
@Test(description = "获取修改记录详情")
public void testPageApply(){
public void testPageApply() {
JSONObject body = merchantTools.getApplyPage();
int total = Integer.parseInt(body.getJSONObject("result").getString("total"));
String applyId = body.getJSONObject("result").getJSONArray("records").getJSONObject(0).getString("id");
JSONObject object = new JSONObject();
object.put("id",0);
object.put("id", applyId);
object.put("studioId", xmAppApi.getLoginInfo().getStudioId());
object.put("brandId", xmAppApi.getLoginInfo().getBrandId());
object.put("operatorId", xmAppApi.getLoginInfo().getAdminId());
xmAppApi.doRequest(RequestType.JSON,params,object.toJSONString(),headers).assetsSuccess(false);
xmAppApi.doRequest(RequestType.JSON, params, object.toJSONString(), headers);
JSONObject response = xmAppApi.getBodyInJSON();
Assert.assertEquals(XMJSONPath.readPath(response,"$.message"),"数据不存在");
if (total != 0) {
Assert.assertEquals(XMJSONPath.readPath(response, "$.message"), "操作成功!");
Assert.assertEquals(XMJSONPath.readPath(response, "$.result.applyType"), "BIND");
Assert.assertEquals(XMJSONPath.readPath(response, "$.result.openState"), "SUCCESS");
} else {
Assert.assertEquals(XMJSONPath.readPath(response, "$.message"), "数据不存在");
}
}
}
package com.xiaomai.cases.polar.studioConfig;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.xiaomai.enums.ApiModule;
import com.xiaomai.enums.RequestType;
import com.xiaomai.enums.Terminal;
import com.xiaomai.utils.XMBaseTest;
import org.springframework.stereotype.Component;
@Component("merchantTools")
public class MerchantTools extends XMBaseTest {
public JSONObject getApplyPage(){
dataApi.setApiModule(ApiModule.Polar_Merchant)
.setApiName("API_pageApply")
.setTerminal(Terminal.B);
super.beforeDataRequest();
JSONObject object = new JSONObject();
object.put("current",0);
object.put("size",20);
object.put("brandId",dataApi.getLoginInfo().getBrandId());
object.put("operatorId",dataApi.getLoginInfo().getAdminId());
dataApi.doRequest(RequestType.JSON,dataparams,object.toJSONString(),dataheadrs).assetsSuccess(true);
return dataApi.getBodyInJSON();
}
}
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