Commit 822182e8 authored by 吕雯燕's avatar 吕雯燕

lv

parent 08c943bc
package http.cases.VisualEditorTest;
import base.Config;
import base.DuibaLog;
import base.DuibaTestBase;
import http.cases.ExchangeTest.Database;
import http.service.hd.DevItemNewService;
import http.service.app.ChwVisualEditorService;
import io.restassured.response.Response;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.testng.Assert;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import utils.PublicMethod;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import http.service.Authorization;
/**
* created by lvwenyan 2019/8/7
*/
public class 商品组件_DuibaTest extends DuibaTestBase{
@Autowired
DevItemNewService devItemNewService;
@Autowired
Authorization authorization;
@Test(description = "后台商品组件新商品展示")
public void 后台商品组件新商品(String appId, List<Integer> itemIdList) throws Exception{
Map cookies = authorization.hdLoginCommonNew("15855555555");
List<Integer> list = new ArrayList<>();
list.add(195115);
Response response = devItemNewService.appItems(cookies,appId,list);
response.prettyPrint();
}
}
......@@ -127,6 +127,38 @@ public class DevItemNewService {
}
//商品组件
public Response appItems(Map cookies, String appId, List<Integer> itemIdList) throws Exception{
String url = hdserverHost + "/devItemNew/appItems";
Map<String,Object> map = new HashMap<>();
map.put("status","on");
map.put("pageSize","300");
map.put("appId",appId);
map.put("pageNo","1");
map.put("itemIdList",itemIdList);
logger.info("请求商品组件接口:"+ "/devItemNew/appItems");
Response response = given().contentType("application/json;charset=UTF-8").cookies(cookies).params(map).get("http://" + url);
try{
Assert.assertEquals(response.jsonPath().getString("success"),"true");
}catch(Exception e){
throw new Exception("/devItemNew/appItems接口返回异常,返回信息:"+response.asString());
}catch(Error er){
throw new Exception("/devItemNew/appItems接口返回异常,返回信息:"+response.asString());
}
return response;
}
......
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