Commit ce9988ca authored by 吕雯燕's avatar 吕雯燕

lv

parent ffe2f9b7
...@@ -466,9 +466,11 @@ public class 兑吧新实物_兑换流程测试_ExchangeTest extends CheckTemple ...@@ -466,9 +466,11 @@ public class 兑吧新实物_兑换流程测试_ExchangeTest extends CheckTemple
logger.info("校验新实物确认下单页正确"); logger.info("校验新实物确认下单页正确");
}
}
......
...@@ -61,7 +61,7 @@ public class 自有新实物_兑换流程测试_ExchangeTest extends CheckTemple ...@@ -61,7 +61,7 @@ public class 自有新实物_兑换流程测试_ExchangeTest extends CheckTemple
} }
} }
@Test(description = "兑吧新自有实物每人限购---每天限制") @Test(description = "新自有实物每人限购---每天限制")
public void 每人限购每天限购限制() throws Exception{ public void 每人限购每天限购限制() throws Exception{
String appItemId = "193752"; String appItemId = "193752";
String itemId = "null"; String itemId = "null";
...@@ -115,7 +115,7 @@ public class 自有新实物_兑换流程测试_ExchangeTest extends CheckTemple ...@@ -115,7 +115,7 @@ public class 自有新实物_兑换流程测试_ExchangeTest extends CheckTemple
} }
} }
@Test(description = "兑吧新自有实物每人限购---永久限制") @Test(description = "新自有实物每人限购---永久限制")
public void 每人限购永久限购限制() throws Exception{ public void 每人限购永久限购限制() throws Exception{
String appItemId = "193802"; String appItemId = "193802";
String itemId = "null"; String itemId = "null";
...@@ -169,7 +169,7 @@ public class 自有新实物_兑换流程测试_ExchangeTest extends CheckTemple ...@@ -169,7 +169,7 @@ public class 自有新实物_兑换流程测试_ExchangeTest extends CheckTemple
} }
} }
@Test(description = "兑吧新自有实物每人限购---周期限制") @Test(description = "新自有实物每人限购---周期限制")
public void 每人限购周期限制() throws Exception{ public void 每人限购周期限制() throws Exception{
String appItemId = "193803"; String appItemId = "193803";
String itemId = "null"; String itemId = "null";
...@@ -221,7 +221,7 @@ public class 自有新实物_兑换流程测试_ExchangeTest extends CheckTemple ...@@ -221,7 +221,7 @@ public class 自有新实物_兑换流程测试_ExchangeTest extends CheckTemple
} }
@Test(description = "兑吧新自有实物每日限量") @Test(description = "新自有实物每日限量")
public void 每日限量限制() throws Exception{ public void 每日限量限制() throws Exception{
String appItemId = "193804"; String appItemId = "193804";
String itemId = "null"; String itemId = "null";
...@@ -321,7 +321,7 @@ public class 自有新实物_兑换流程测试_ExchangeTest extends CheckTemple ...@@ -321,7 +321,7 @@ public class 自有新实物_兑换流程测试_ExchangeTest extends CheckTemple
} }
@Test(description = "兑吧新自有实物--库存限制") @Test(description = "新自有实物--库存限制")
public void 库存限制() throws Exception{ public void 库存限制() throws Exception{
String appItemId = "193811"; String appItemId = "193811";
String itemId = "null"; String itemId = "null";
...@@ -356,7 +356,7 @@ public class 自有新实物_兑换流程测试_ExchangeTest extends CheckTemple ...@@ -356,7 +356,7 @@ public class 自有新实物_兑换流程测试_ExchangeTest extends CheckTemple
@Test(description = "兑吧新自有实物会员兑换限制") @Test(description = "新自有实物会员兑换限制")
public void 会员兑换限制() throws Exception{ public void 会员兑换限制() throws Exception{
String appItemId = "193810"; String appItemId = "193810";
String itemId = "null"; String itemId = "null";
...@@ -381,6 +381,36 @@ public class 自有新实物_兑换流程测试_ExchangeTest extends CheckTemple ...@@ -381,6 +381,36 @@ public class 自有新实物_兑换流程测试_ExchangeTest extends CheckTemple
} }
@Test(description = "新自有实物用户id修改测试")
public void 实物用户id篡改测试() throws Exception{
//uid: 大富翁app
//商品: lv测试应用55
int uid = 7204;
String appItemId = "197041";
String itemId = null ;
String message = "";
//实物兑换
try{
Response response =gawService.objectExchange(uid,appItemId,itemId);
response.prettyPrint();
}catch (Exception e){
message = e.toString();
}
logger.info(message);
Assert.assertTrue(message.contains("\"desc\":\"无权访问\""),"校验message失败");
Assert.assertTrue(message.contains("\"success\":false"),"校验success失败");
logger.info("校验实物用户id篡改无法兑换成功");
}
//测试使用 //测试使用
//@Test(enabled=true, dataProvider="testdp", threadPoolSize=1, invocationCount=100) //@Test(enabled=true, dataProvider="testdp", threadPoolSize=1, invocationCount=100)
@DataProvider(name = "testdp", parallel = true) @DataProvider(name = "testdp", parallel = true)
...@@ -399,6 +429,8 @@ public class 自有新实物_兑换流程测试_ExchangeTest extends CheckTemple ...@@ -399,6 +429,8 @@ public class 自有新实物_兑换流程测试_ExchangeTest extends CheckTemple
}; };
} }
// @Test(enabled=true, dataProvider="testdp", threadPoolSize=1, invocationCount=100) // @Test(enabled=true, dataProvider="testdp", threadPoolSize=1, invocationCount=100)
public void test(int uid) throws Exception { public void test(int uid) throws Exception {
// System.out.println("Current Thread Id: " + Thread.currentThread().getId() + ". Dataprovider number: "+ dpNumber); // System.out.println("Current Thread Id: " + Thread.currentThread().getId() + ". Dataprovider number: "+ dpNumber);
......
...@@ -123,15 +123,17 @@ public class gawService { ...@@ -123,15 +123,17 @@ public class gawService {
} }
//优惠券兑换接口
public Response couponExchange(int uid, String appItemId,int skuId) throws Exception { //普通自有新实物兑换接口
public Response objectExchange(int uid, String appItemId,String itemId,String skuId,String credits,String actualCredits ) throws Exception {
Map<String,Object> map = new HashMap<>(); Map<String,Object> map = new HashMap<>();
Map<String,Object> mapList = new HashMap<>(); Map<String,Object> mapList = new HashMap<>();
List<Map> list = new ArrayList<>(); List<Map> list = new ArrayList<>();
mapList.put("itemId",itemId);
mapList.put("skuId",skuId); mapList.put("skuId",skuId);
mapList.put("appItemId",appItemId); mapList.put("appItemId",appItemId);
mapList.put("credits","100"); mapList.put("credits",credits);
mapList.put("price",0); mapList.put("price",0);
list.add(mapList); list.add(mapList);
...@@ -139,7 +141,7 @@ public class gawService { ...@@ -139,7 +141,7 @@ public class gawService {
map.put("remark",""); //买家留言 map.put("remark",""); //买家留言
map.put("degreeId",""); map.put("degreeId","");
map.put("actualPrice","0"); //总金额 map.put("actualPrice","0"); //总金额
map.put("actualCredits","100"); //总积分 map.put("actualCredits",actualCredits); //总积分
map.put("itemParam",list.toArray()); map.put("itemParam",list.toArray());
map.put("payType","3"); map.put("payType","3");
map.put("expressPrice","0"); map.put("expressPrice","0");
...@@ -148,8 +150,8 @@ public class gawService { ...@@ -148,8 +150,8 @@ public class gawService {
JSONObject jsonParam = JSONObject.parseObject(JSON.toJSONString(map)); JSONObject jsonParam = JSONObject.parseObject(JSON.toJSONString(map));
logger.info("请求实物兑换接口:"+ "/gaw/couponExchange/create"); logger.info("请求实物兑换接口:"+ "/gaw/objectExchange/create");
Response response = given().contentType("application/json; charset=UTF-8").cookies(authorization.dafuwengLogin(uid)).body(jsonParam).post("http://"+goodsHost+"/gaw/couponExchange/create"); Response response = given().contentType("application/json; charset=UTF-8").cookies(authorization.dafuwengLogin(uid)).body(jsonParam).post("http://"+goodsHost+"/gaw/objectExchange/create");
// Response saveResponse = given().contentType("application/x-www-form-urlencoded;charset=UTF-8").cookies(authorization.dafuwengLogin(uid)).params(map).post("http://"+goodsHost+"/gaw/objectExchange/create"); // Response saveResponse = given().contentType("application/x-www-form-urlencoded;charset=UTF-8").cookies(authorization.dafuwengLogin(uid)).params(map).post("http://"+goodsHost+"/gaw/objectExchange/create");
...@@ -165,16 +167,42 @@ public class gawService { ...@@ -165,16 +167,42 @@ public class gawService {
} }
return response; return response;
}
//实物确认下单
public Response confirmItemDetail (int uid, String appItemId, String appSkuId) throws Exception {
Map<String,Object> map = new HashMap<>();
map.put("degreeId","");
map.put("appItemId",appItemId);
map.put("payType", 3);
map.put("appSkuId",appSkuId);
map.put("vipFlag",false);
logger.info("请求确认下单页接口:"+ "/gaw/h5/confirmItemDetail");
Response response = given().contentType("application/json; charset=UTF-8").cookies(authorization.dafuwengLogin(uid)).params(map).get("http://"+goodsHost+"/gaw/h5/confirmItemDetail");
try{
Assert.assertEquals(response.jsonPath().getString("success"),"true");
}catch(Exception e){
throw new Exception("/gaw/h5/confirmItemDetail接口返回异常,返回信息:"+response.asString());
}catch(Error er){
throw new Exception("/gaw/h5/confirmItemDetail接口返回异常,返回信息:"+response.asString());
}
return response;
} }
//优惠券兑换
public Response couponExchange(Map cookies, String appItemId,String itemId,String skuId) throws Exception { //优惠券兑换接口
public Response couponExchange(int uid, String appItemId,int skuId) throws Exception {
Map<String,Object> map = new HashMap<>(); Map<String,Object> map = new HashMap<>();
Map<String,Object> mapList = new HashMap<>(); Map<String,Object> mapList = new HashMap<>();
List<Map> list = new ArrayList<>(); List<Map> list = new ArrayList<>();
mapList.put("itemId",itemId);
mapList.put("skuId",skuId); mapList.put("skuId",skuId);
mapList.put("appItemId",appItemId); mapList.put("appItemId",appItemId);
mapList.put("credits","100"); mapList.put("credits","100");
...@@ -183,38 +211,44 @@ public class gawService { ...@@ -183,38 +211,44 @@ public class gawService {
map.put("remark",""); //买家留言 map.put("remark",""); //买家留言
map.put("degreeId","");
map.put("actualPrice","0"); //总金额 map.put("actualPrice","0"); //总金额
map.put("actualCredits","100"); //总积分 map.put("actualCredits","100"); //总积分
map.put("itemParam",list.toArray()); map.put("itemParam",list.toArray());
map.put("payType","3"); map.put("payType","3");
map.put("expressPrice","0");
map.put("validate",""); map.put("validate","");
map.put("token","yrJRr7Cddp2YeQd"); map.put("token","yrJRr7Cddp2YeQd");
JSONObject jsonParam = JSONObject.parseObject(JSON.toJSONString(map)); JSONObject jsonParam = JSONObject.parseObject(JSON.toJSONString(map));
logger.info("请求实物兑换接口:"+ "/gaw/couponExchange/create"); logger.info("请求实物兑换接口:"+ "/gaw/couponExchange/create");
Response response = given().contentType("application/json; charset=UTF-8").cookies(cookies).body(jsonParam).post("http://"+goodsHost+"/gaw/couponExchange/create"); Response response = given().contentType("application/json; charset=UTF-8").cookies(authorization.dafuwengLogin(uid)).body(jsonParam).post("http://"+goodsHost+"/gaw/couponExchange/create");
// Response saveResponse = given().contentType("application/x-www-form-urlencoded;charset=UTF-8").cookies(authorization.dafuwengLogin(uid)).params(map).post("http://"+goodsHost+"/gaw/objectExchange/create");
// response.prettyPrint();
try{ try{
Assert.assertEquals(response.jsonPath().getString("success"),"true"); Assert.assertEquals(response.jsonPath().getString("success"),"true");
}catch(Exception e){ }catch(Exception e){
throw new Exception("/gaw/couponExchange/create接口返回异常,返回信息:"+response.asString()); throw new Exception("/gaw/objectExchange/create接口返回异常,返回信息:"+response.asString());
}catch(Error er){ }catch(Error er){
throw new Exception("/gaw/couponExchange/create接口返回异常,返回信息:"+response.asString()); throw new Exception("/gaw/objectExchange/create接口返回异常,返回信息:"+response.asString());
} }
return response; return response;
} }
//优惠券兑换接口 //优惠券兑换
public Response couponExchange(Map cookie, String appItemId,int skuId) throws Exception { public Response couponExchange(Map cookies, String appItemId,String itemId,String skuId) throws Exception {
Map<String,Object> map = new HashMap<>(); Map<String,Object> map = new HashMap<>();
Map<String,Object> mapList = new HashMap<>(); Map<String,Object> mapList = new HashMap<>();
List<Map> list = new ArrayList<>(); List<Map> list = new ArrayList<>();
mapList.put("itemId",itemId);
mapList.put("skuId",skuId); mapList.put("skuId",skuId);
mapList.put("appItemId",appItemId); mapList.put("appItemId",appItemId);
mapList.put("credits","100"); mapList.put("credits","100");
...@@ -223,39 +257,34 @@ public class gawService { ...@@ -223,39 +257,34 @@ public class gawService {
map.put("remark",""); //买家留言 map.put("remark",""); //买家留言
map.put("degreeId","");
map.put("actualPrice","0"); //总金额 map.put("actualPrice","0"); //总金额
map.put("actualCredits","100"); //总积分 map.put("actualCredits","100"); //总积分
map.put("itemParam",list.toArray()); map.put("itemParam",list.toArray());
map.put("payType","3"); map.put("payType","3");
map.put("expressPrice","0");
map.put("validate",""); map.put("validate","");
map.put("token","yrJRr7Cddp2YeQd"); map.put("token","yrJRr7Cddp2YeQd");
JSONObject jsonParam = JSONObject.parseObject(JSON.toJSONString(map)); JSONObject jsonParam = JSONObject.parseObject(JSON.toJSONString(map));
logger.info("请求实物兑换接口:"+ "/gaw/couponExchange/create"); logger.info("请求实物兑换接口:"+ "/gaw/couponExchange/create");
Response response = given().contentType("application/json; charset=UTF-8").cookies(cookie).body(jsonParam).post("http://"+goodsHost+"/gaw/couponExchange/create"); Response response = given().contentType("application/json; charset=UTF-8").cookies(cookies).body(jsonParam).post("http://"+goodsHost+"/gaw/couponExchange/create");
// Response saveResponse = given().contentType("application/x-www-form-urlencoded;charset=UTF-8").cookies(authorization.dafuwengLogin(uid)).params(map).post("http://"+goodsHost+"/gaw/objectExchange/create");
// response.prettyPrint();
try{ try{
Assert.assertEquals(response.jsonPath().getString("success"),"true"); Assert.assertEquals(response.jsonPath().getString("success"),"true");
}catch(Exception e){ }catch(Exception e){
throw new Exception("/gaw/objectExchange/create接口返回异常,返回信息:"+response.asString()); throw new Exception("/gaw/couponExchange/create接口返回异常,返回信息:"+response.asString());
}catch(Error er){ }catch(Error er){
throw new Exception("/gaw/objectExchange/create接口返回异常,返回信息:"+response.asString()); throw new Exception("/gaw/couponExchange/create接口返回异常,返回信息:"+response.asString());
} }
return response; return response;
} }
//虚拟商品兑换接口 //优惠券兑换接口
public Response virtualExchange(Map cookie, String appItemId,int skuId) throws Exception { public Response couponExchange(Map cookie, String appItemId,int skuId) throws Exception {
Map<String,Object> map = new HashMap<>(); Map<String,Object> map = new HashMap<>();
Map<String,Object> mapList = new HashMap<>(); Map<String,Object> mapList = new HashMap<>();
...@@ -280,7 +309,7 @@ public class gawService { ...@@ -280,7 +309,7 @@ public class gawService {
JSONObject jsonParam = JSONObject.parseObject(JSON.toJSONString(map)); JSONObject jsonParam = JSONObject.parseObject(JSON.toJSONString(map));
logger.info("请求实物兑换接口:"+ "/gaw/couponExchange/create"); logger.info("请求实物兑换接口:"+ "/gaw/couponExchange/create");
Response response = given().contentType("application/json; charset=UTF-8").cookies(cookie).body(jsonParam).post("http://"+goodsHost+"/gaw/virtualExchange/create"); Response response = given().contentType("application/json; charset=UTF-8").cookies(cookie).body(jsonParam).post("http://"+goodsHost+"/gaw/couponExchange/create");
// Response saveResponse = given().contentType("application/x-www-form-urlencoded;charset=UTF-8").cookies(authorization.dafuwengLogin(uid)).params(map).post("http://"+goodsHost+"/gaw/objectExchange/create"); // Response saveResponse = given().contentType("application/x-www-form-urlencoded;charset=UTF-8").cookies(authorization.dafuwengLogin(uid)).params(map).post("http://"+goodsHost+"/gaw/objectExchange/create");
...@@ -299,17 +328,15 @@ public class gawService { ...@@ -299,17 +328,15 @@ public class gawService {
} }
//虚拟商品兑换接口
//普通自有新实物兑换接口 public Response virtualExchange(Map cookie, String appItemId,int skuId) throws Exception {
public Response objectExchange(int uid, String appItemId,String itemId,String skuId,String credits,String actualCredits ) throws Exception {
Map<String,Object> map = new HashMap<>(); Map<String,Object> map = new HashMap<>();
Map<String,Object> mapList = new HashMap<>(); Map<String,Object> mapList = new HashMap<>();
List<Map> list = new ArrayList<>(); List<Map> list = new ArrayList<>();
mapList.put("itemId",itemId);
mapList.put("skuId",skuId); mapList.put("skuId",skuId);
mapList.put("appItemId",appItemId); mapList.put("appItemId",appItemId);
mapList.put("credits",credits); mapList.put("credits","100");
mapList.put("price",0); mapList.put("price",0);
list.add(mapList); list.add(mapList);
...@@ -317,7 +344,7 @@ public class gawService { ...@@ -317,7 +344,7 @@ public class gawService {
map.put("remark",""); //买家留言 map.put("remark",""); //买家留言
map.put("degreeId",""); map.put("degreeId","");
map.put("actualPrice","0"); //总金额 map.put("actualPrice","0"); //总金额
map.put("actualCredits",actualCredits); //总积分 map.put("actualCredits","100"); //总积分
map.put("itemParam",list.toArray()); map.put("itemParam",list.toArray());
map.put("payType","3"); map.put("payType","3");
map.put("expressPrice","0"); map.put("expressPrice","0");
...@@ -326,8 +353,8 @@ public class gawService { ...@@ -326,8 +353,8 @@ public class gawService {
JSONObject jsonParam = JSONObject.parseObject(JSON.toJSONString(map)); JSONObject jsonParam = JSONObject.parseObject(JSON.toJSONString(map));
logger.info("请求实物兑换接口:"+ "/gaw/objectExchange/create"); logger.info("请求实物兑换接口:"+ "/gaw/couponExchange/create");
Response response = given().contentType("application/json; charset=UTF-8").cookies(authorization.dafuwengLogin(uid)).body(jsonParam).post("http://"+goodsHost+"/gaw/objectExchange/create"); Response response = given().contentType("application/json; charset=UTF-8").cookies(cookie).body(jsonParam).post("http://"+goodsHost+"/gaw/virtualExchange/create");
// Response saveResponse = given().contentType("application/x-www-form-urlencoded;charset=UTF-8").cookies(authorization.dafuwengLogin(uid)).params(map).post("http://"+goodsHost+"/gaw/objectExchange/create"); // Response saveResponse = given().contentType("application/x-www-form-urlencoded;charset=UTF-8").cookies(authorization.dafuwengLogin(uid)).params(map).post("http://"+goodsHost+"/gaw/objectExchange/create");
...@@ -343,6 +370,7 @@ public class gawService { ...@@ -343,6 +370,7 @@ public class gawService {
} }
return response; return response;
} }
...@@ -578,30 +606,5 @@ public class gawService { ...@@ -578,30 +606,5 @@ public class gawService {
} }
//实物确认下单
public Response confirmItemDetail (int uid, String appItemId, String appSkuId) throws Exception {
Map<String,Object> map = new HashMap<>();
map.put("degreeId","");
map.put("appItemId",appItemId);
map.put("payType", 3);
map.put("appSkuId",appSkuId);
map.put("vipFlag",false);
logger.info("请求确认下单页接口:"+ "/gaw/h5/confirmItemDetail");
Response response = given().contentType("application/json; charset=UTF-8").cookies(authorization.dafuwengLogin(uid)).params(map).get("http://"+goodsHost+"/gaw/h5/confirmItemDetail");
try{
Assert.assertEquals(response.jsonPath().getString("success"),"true");
}catch(Exception e){
throw new Exception("/gaw/h5/confirmItemDetail接口返回异常,返回信息:"+response.asString());
}catch(Error er){
throw new Exception("/gaw/h5/confirmItemDetail接口返回异常,返回信息:"+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