Commit 9fd3d239 authored by 马博's avatar 马博

Merge remote-tracking branch 'origin/master'

parents 1c8cea36 7d9b4b97
......@@ -5,18 +5,21 @@ public class Database {
//主订单库
public static String orders_consumer = "orders_consumer";
//主订单分表
public static String orders = "orders_0614";
public static String orders2 = "orders_0874";
public static String orders3 = "orders_0693";
public static String orders4 = "orders_0208";
public static String orders5 = "orders_0209";
public static String orders6 = "orders_0210";
public static String orders7 = "orders_0211";
public static String orders8 = "orders_0090";
public static String orders9 = "orders_0203";
public static String orders10 = "orders_0411";
public static String orders11 = "orders_0182";
public static String orders12 = "orders_0715";
public static String orders13 = "orders_0717";
public static String orders14 = "orders_0712";
public static String orders15 = "orders_0718";
public static String orders16 = "orders_0721";
......
package http.cases.ExchangeTest.兑吧_直充类商品兑换;
import http.cases.ExchangeTest.CheckTemplet;
import http.cases.ExchangeTest.Database;
import http.service.Authorization;
import http.service.app.gawService;
import http.service.app.MobileService;
......@@ -146,6 +147,7 @@ public class 新Qb_兑换流程测试_ExchangeTest extends CheckTemplet {
}
@Test(description = "3个Q币用户兑换限制每月1次")
public void Q币用户每月兑换限制测试() throws Exception{
......@@ -164,7 +166,7 @@ public class 新Qb_兑换流程测试_ExchangeTest extends CheckTemplet {
logger.info("用户成功兑换一次");
//再次兑换
Thread.sleep(3000);
Thread.sleep(4000);
try{
response = gawService.qbExchange(uid,actualCredits,degreeId,appItemId,credits,"123456789");
response.prettyPrint();
......@@ -242,6 +244,86 @@ public class 新Qb_兑换流程测试_ExchangeTest extends CheckTemplet {
}
@Test(description = "Q币档位篡改测试")
public void Q币档位篡改测试() throws Exception{
int uid = 7293;
String actualCredits = "3";
String degreeId = "100";
String appItemId = "196922";
String credits = "3";
String qq = "806854056";
String message = "";
//Q币兑换,档位参数不存在
try{
Response response = gawService.qbExchange(uid,actualCredits,degreeId,appItemId,credits,qq);
response.prettyPrint();
}catch (Exception e){
message = e.toString();
}
logger.info(message);
Assert.assertTrue(message.contains("\"success\":false"),"校验message失败");
Assert.assertTrue(message.contains("\"desc\":\"档位不存在\""),"校验message失败");
logger.info("校验Q币档位篡改无法兑换成功");
}
@Test(description = "Q币用户id篡改测试")
public void Q币用户id篡改测试() throws Exception{
//商品: lv测试应用77
//uid1: 大富翁app
//uid2: lv测试应用88
int uid1 = 7084;
int uid2 = 7292;
String actualCredits = "3";
String degreeId = "3";
String appItemId = "196922";
String credits = "3";
String qq = "806854056";
String message = "";
//话费兑换, 大富翁app已上架Q币
Response response = gawService.qbExchange(uid1,actualCredits,degreeId,appItemId,credits,qq);
response.prettyPrint();
String orderId = response.jsonPath().getString("data.orderId");
//查询数据库
Thread.sleep(3000);
Map<String,Object> mapOrderId = jdbc.findSimpleResult("SELECT * FROM "+ Database.orders_consumer+"."+ Database.orders16 + " where id = " + orderId);
String orderStatus = String.valueOf(mapOrderId.get("status"));
String orderappId = String.valueOf(mapOrderId.get("app_id"));
String orderCredits = String.valueOf(mapOrderId.get("credits"));
logger.info("订单积分:" + orderCredits);
Assert.assertEquals(orderStatus,"consume_success","校验status失败");
Assert.assertEquals(orderappId,"1","校验appId失败");
Assert.assertEquals(orderCredits,"300","校验credits失败");
logger.info("校验Q币用户id1篡改兑换成功");
//Q币兑换,lv测试应用88app未上架Q币
try{
Response response2 = gawService.qbExchange(uid2,actualCredits,degreeId,appItemId,credits,qq);
response2.prettyPrint();
}catch (Exception e){
message = e.toString();
}
logger.info(message);
Assert.assertTrue(message.contains("\"success\":false"),"校验message失败");
Assert.assertTrue(message.contains("\"desc\":\"兑吧加钱购商品不可以加入到开发者商品中\""),"校验message失败"); //这个提示很奇怪
logger.info("校验Q币用户id2篡改无法兑换成功");
}
public Response Q币兑换(int uid, String actualCredits, String degreeId, String appItemId, String credits, String qq) throws Exception {
Response response = gawService.qbExchange(uid,actualCredits,degreeId,appItemId,credits,qq);
......
package http.cases.ExchangeTest.兑吧_直充类商品兑换;
import http.cases.ExchangeTest.CheckTemplet;
import http.cases.ExchangeTest.Database;
import http.service.Authorization;
import http.service.app.gawService;
import http.service.app.MobileService;
......@@ -240,6 +241,86 @@ public class 新多档位话费_兑换流程测试_ExchangeTest extends CheckTem
}
@Test(description = "话费档位篡改测试")
public void 话费档位篡改测试() throws Exception{
int uid = 7268;
String actualCredits = "2";
String degreeId = "100";
String appItemId = "196923";
String credits = "2";
String message = "";
//话费兑换,档位参数不存在
try{
Thread.sleep(3000);
Response response = gawService.phonebillExchange(uid,actualCredits,degreeId,appItemId,credits);
response.prettyPrint();
}catch (Exception e){
message = e.toString();
}
logger.info(message);
Assert.assertTrue(message.contains("\"success\":false"),"校验message失败");
Assert.assertTrue(message.contains("\"desc\":\"档位不存在\""),"校验message失败");
logger.info("校验话费档位篡改无法兑换成功");
}
@Test(description = "话费用户id篡改测试")
public void 话费用户id篡改测试() throws Exception{
//商品: lv测试应用77
//uid1: 大富翁app
//uid2: lv测试应用88
int uid1 = 7085;
int uid2 = 7292;
String actualCredits = "5";
String degreeId = "10";
String appItemId = "196923";
String credits = "5";
String message = "";
//话费兑换, 大富翁app已上架话费
Response response = gawService.phonebillExchange(uid1,actualCredits,degreeId,appItemId,credits);
response.prettyPrint();
String orderId = response.jsonPath().getString("data.orderId");
//查询数据库
Thread.sleep(3000);
Map<String,Object> mapOrderId = jdbc.findSimpleResult("SELECT * FROM "+ Database.orders_consumer+"."+ Database.orders15 + " where id = " + orderId);
String orderStatus = String.valueOf(mapOrderId.get("status"));
String orderappId = String.valueOf(mapOrderId.get("app_id"));
String orderCredits = String.valueOf(mapOrderId.get("credits"));
logger.info("订单积分:" + orderCredits);
Assert.assertEquals(orderStatus,"consume_success","校验status失败");
Assert.assertEquals(orderappId,"1","校验appId失败");
Assert.assertEquals(orderCredits,"1000","校验credits失败");
logger.info("校验话费用户id1篡改兑换成功");
//话费兑换,lv测试应用88app未上架话费
try{
Response response2 = gawService.phonebillExchange(uid2,actualCredits,degreeId,appItemId,credits);
response2.prettyPrint();
}catch (Exception e){
message = e.toString();
}
logger.info(message);
Assert.assertTrue(message.contains("\"success\":false"),"校验message失败");
Assert.assertTrue(message.contains("\"desc\":\"无权访问\""),"校验message失败");
logger.info("校验话费用户id2篡改无法兑换成功");
}
public Response 话费兑换(int uid, String actualCredits, String degreeId, String appItemId, String credits) throws Exception {
Response response = gawService.phonebillExchange(uid,actualCredits,degreeId,appItemId,credits);
......
......@@ -302,6 +302,56 @@ public class 新支付宝_兑换流程测试_ExchangeTest extends CheckTemplet {
}
@Test(description = "支付宝用户id修改测试")
public void 支付宝用户id篡改测试() throws Exception{
//商品: lv测试应用77
//uid1: 大富翁app
//uid2: lv测试应用88
int uid1 = 7204;
int uid2 = 7291;
String actualCredits = "10";
String degreeId = "10";
String appItemId = "196921";
String credits = "10";
String message = "";
//支付宝兑换, 大富翁app已上架支付宝
Response response = gawService.alipayExchange(uid1,actualCredits,degreeId,appItemId,credits);
response.prettyPrint();
String orderId = response.jsonPath().getString("data.orderId");
//查询数据库
Thread.sleep(3000);
Map<String,Object> mapOrderId = jdbc.findSimpleResult("SELECT * FROM "+ Database.orders_consumer+"."+ Database.orders13 + " where id = " + orderId);
String orderStatus = String.valueOf(mapOrderId.get("status"));
String orderappId = String.valueOf(mapOrderId.get("app_id"));
String orderCredits = String.valueOf(mapOrderId.get("credits"));
logger.info("订单积分:" + orderCredits);
Assert.assertEquals(orderStatus,"consume_success","校验status失败");
Assert.assertEquals(orderappId,"1","校验appId失败");
Assert.assertEquals(orderCredits,"1000","校验credits失败");
logger.info("校验支付宝用户id1篡改兑换成功");
//支付宝兑换,lv测试应用88app未上架支付宝
try{
Response response2 = gawService.alipayExchange(uid2,actualCredits,degreeId,appItemId,credits);
response2.prettyPrint();
}catch (Exception e){
message = e.toString();
}
logger.info(message);
Assert.assertTrue(message.contains("\"success\":false"),"校验message失败");
Assert.assertTrue(message.contains("\"desc\":\"商家未采购商品\""),"校验message失败");
logger.info("校验支付宝用户id2篡改无法兑换成功");
}
......
......@@ -506,6 +506,64 @@ public class 兑吧卡密_兑换流程测试_ExchangeTest extends CheckTemplet {
}
@Test(description = "兑吧卡密用户id篡改测试")
public void 卡密用户id篡改测试() throws Exception{
//uid: 大富翁app
//商品: lv测试应用55
int uid = 11;
String appItemId = "197045";
String itemId = "32657";
String skuId = "173";
String message = "";
Map cookies = authorization.dafuwengLogin(uid);
//卡密兑换
try{
Response response = gawService.couponExchange(cookies,appItemId,itemId,skuId);
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(description = "兑吧卡密skuId篡改测试")
public void 卡密skuId篡改测试() throws Exception{
String appItemId = "197045";
String itemId = "32657";
String skuId = "106";
String message = "";
Map cookies = authorization.dafuwengLogin(uid);
//优惠券兑换,skuId改为其它商品的
try{
Response response = gawService.couponExchange(cookies,appItemId,itemId,skuId);
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("校验卡密skuId篡改无法兑换成功");
}
}
......@@ -498,5 +498,62 @@ public class 兑吧新优惠券_兑换流程测试_ExchangeTest extends CheckTem
@Test(description = "新优惠券用户id篡改测试")
public void 优惠券用户id篡改测试() throws Exception{
//uid: 大富翁app
//商品: lv测试应用55
int uid = 10;
String appItemId = "197044";
String itemId = "32656";
String message = "";
Map cookies = authorization.dafuwengLogin(uid);
//优惠券兑换
try{
Response response = gawService.couponExchange(cookies,appItemId,itemId,"172");
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(description = "新优惠券skuId篡改测试")
public void 优惠券skuId篡改测试() throws Exception{
int uid = 7289;
String appItemId = "197044";
String itemId = "32656" ;
String message = "";
Map cookies = authorization.dafuwengLogin(uid);
//优惠券兑换,skuId改为其它商品的
try{
Response response = gawService.couponExchange(cookies,appItemId,itemId,"105");
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("校验优惠券skuId篡改无法兑换成功");
}
}
......@@ -50,9 +50,9 @@ public class 兑吧新实物_兑换流程测试_ExchangeTest extends CheckTemple
Object[][] result = null;
if (method.getName().equals("日期兑换限制测试")) {
result = new Object[][]{
new Object[]{1, "193805", "32506", "兑吧新实物日期兑换限制未开始"}, //case1
new Object[]{2, "193806", "32507", "兑吧新实物日期兑换限制进行中"}, //case2
new Object[]{3, "193807", "32508", "兑吧新实物日期兑换限制已结束"}, //case3
new Object[]{1, "193805", "32506", "27", "兑吧新实物日期兑换限制未开始"}, //case1
new Object[]{2, "193806", "32507", "28","兑吧新实物日期兑换限制进行中"}, //case2
new Object[]{3, "193807", "32508", "29","兑吧新实物日期兑换限制已结束"}, //case3
};
}
return result;
......@@ -64,10 +64,11 @@ public class 兑吧新实物_兑换流程测试_ExchangeTest extends CheckTemple
String appItemId = "192950";
String itemId = "32439";
String skuId = "16";
String message = "";
try{
//第一次兑换
Response response = gawService.objectExchange(uid,appItemId,itemId);
Response response = gawService.objectExchange(uid,appItemId,itemId,skuId);
String orderId = response.jsonPath().getString("data.orderId");
//获取兑换结果
response = tawService.orderStatus(orderId,uid);
......@@ -91,7 +92,7 @@ public class 兑吧新实物_兑换流程测试_ExchangeTest extends CheckTemple
//第二次兑换
Thread.sleep(3000);
try{
response = gawService.objectExchange(uid,appItemId,itemId);
response = gawService.objectExchange(uid,appItemId,itemId,skuId);
response.prettyPrint();
}catch (Exception e){
......@@ -123,11 +124,12 @@ public class 兑吧新实物_兑换流程测试_ExchangeTest extends CheckTemple
String appItemId = "193756";
String itemId = "32500";
String skuId = "18";
String message = "";
try{
//第一次兑换
Response response = gawService.objectExchange(uid,appItemId,itemId);
Response response = gawService.objectExchange(uid,appItemId,itemId,skuId);
String orderId = response.jsonPath().getString("data.orderId");
//获取兑换结果
response = tawService.orderStatus(orderId,uid);
......@@ -151,7 +153,7 @@ public class 兑吧新实物_兑换流程测试_ExchangeTest extends CheckTemple
//第二次兑换
Thread.sleep(3000);
try{
response = gawService.objectExchange(uid,appItemId,itemId);
response = gawService.objectExchange(uid,appItemId,itemId,skuId);
response.prettyPrint();
}catch (Exception e){
......@@ -185,11 +187,12 @@ public class 兑吧新实物_兑换流程测试_ExchangeTest extends CheckTemple
String appItemId = "193757";
String itemId = "32501";
String skuId = "19";
String message = "";
try{
//第一次兑换
Response response = gawService.objectExchange(uid,appItemId,itemId);
Response response = gawService.objectExchange(uid,appItemId,itemId,skuId);
String orderId = response.jsonPath().getString("data.orderId");
//获取兑换结果
response = tawService.orderStatus(orderId,uid);
......@@ -213,7 +216,7 @@ public class 兑吧新实物_兑换流程测试_ExchangeTest extends CheckTemple
//第二次兑换
Thread.sleep(3000);
try{
response = gawService.objectExchange(uid,appItemId,itemId);
response = gawService.objectExchange(uid,appItemId,itemId,skuId);
response.prettyPrint();
}catch (Exception e){
......@@ -247,11 +250,12 @@ public class 兑吧新实物_兑换流程测试_ExchangeTest extends CheckTemple
String appItemId = "193801";
String itemId = "32505";
String skuId = "23";
String message = "";
try{
//第一次兑换
Response response = gawService.objectExchange(uid,appItemId,itemId);
Response response = gawService.objectExchange(uid,appItemId,itemId,skuId);
String orderId = response.jsonPath().getString("data.orderId");
//获取兑换结果
response = tawService.orderStatus(orderId,uid);
......@@ -275,7 +279,7 @@ public class 兑吧新实物_兑换流程测试_ExchangeTest extends CheckTemple
//第二次兑换
Thread.sleep(3000);
try{
response = gawService.objectExchange(uid,appItemId,itemId);
response = gawService.objectExchange(uid,appItemId,itemId,skuId);
response.prettyPrint();
}catch (Exception e){
......@@ -307,18 +311,19 @@ public class 兑吧新实物_兑换流程测试_ExchangeTest extends CheckTemple
* @param caseNum 用例编号
* @param appItemId 商品入库Id
* @param itemId 商品id
* @param skuId skuId
* @param caseName 用例名称打印
* @throws Exception
*/
@Test(dataProvider = "providerMethod")
public void 日期兑换限制测试(int caseNum, String appItemId, String itemId, String caseName) throws Exception{
public void 日期兑换限制测试(int caseNum, String appItemId, String itemId, String skuId, String caseName) throws Exception{
String message = "";
logger.info(caseName);
//兑换
try{
Response response = gawService.objectExchange(uid,appItemId,itemId);
Response response = gawService.objectExchange(uid,appItemId,itemId,skuId);
response.prettyPrint();
}catch (Exception e){
......@@ -362,11 +367,12 @@ public class 兑吧新实物_兑换流程测试_ExchangeTest extends CheckTemple
String appItemId = "193808";
String itemId = "32509";
String skuId = "30";
String message = "";
//会员等级无法兑换
try{
Response response =gawService.objectExchange(uid,appItemId,itemId);
Response response =gawService.objectExchange(uid,appItemId,itemId,skuId);
response.prettyPrint();
}catch (Exception e){
......@@ -375,7 +381,7 @@ public class 兑吧新实物_兑换流程测试_ExchangeTest extends CheckTemple
logger.info(message);
//会员等级可兑换,vip=5
Response response = gawService.objectExchange(authorization.generateSignAutoLogin("vc2HvzM439YBQiB6LVy4uxC4uWm",7001),appItemId,itemId,"16");
Response response = gawService.objectExchange(authorization.generateSignAutoLogin("vc2HvzM439YBQiB6LVy4uxC4uWm",7001),appItemId,itemId,skuId);
response.prettyPrint();
Assert.assertTrue(message.contains("未达到会员等级要求"),"校验message失败");
......@@ -446,27 +452,59 @@ public class 兑吧新实物_兑换流程测试_ExchangeTest extends CheckTemple
}
@Test(description = "新实物确认下单页面")
public void 实物确认下单测试() throws Exception{
@Test(description = "新实物用户id篡改测试")
public void 实物用户id篡改测试() throws Exception{
String appItemId = "196218";
String appSkuId = "145";
//uid: 大富翁app
//商品: lv测试应用55
int uid = 8;
String appItemId = "197040";
String itemId = "32655" ;
String skuId = "163";
String message = "";
Map cookies = authorization.dafuwengLogin(uid);
Response response = gawService.confirmItemDetail(uid,appItemId,appSkuId);
response.prettyPrint();
//实物兑换
try{
Response response = gawService.objectExchange(cookies,appItemId,itemId,skuId);
response.prettyPrint();
Assert.assertEquals(response.jsonPath().getString("data.items[0].sku.attr[0].value"),"白色","校验sku信息颜色失败");
Assert.assertEquals(response.jsonPath().getString("data.items[0].sku.attr[1].value"),"S","校验sku信息尺寸失败");
Assert.assertEquals(response.jsonPath().getString("data.items[0].sku.credits"),"100","校验sku商品积分失败");
Assert.assertEquals(response.jsonPath().getString("data.items[0].multiImage"),"//yun.dui88.com/images/201906/9p72lmu1qn.jpg","校验图片信息失败");
Assert.assertEquals(response.jsonPath().getString("data.items[0].title"),"【自动化勿动】自有实物sku","校验实物名称失败");
Assert.assertEquals(response.jsonPath().getString("data.orderCredits"),"100","校验订单积分失败");
Assert.assertEquals(response.jsonPath().getString("data.expressPrice"),"500","校验订单运费金额失败");
Assert.assertEquals(response.jsonPath().getString("data.consumerPayPrice"),"500","校验订单支付金额失败");
}catch (Exception e){
logger.info("校验新实物确认下单页正确");
message = e.toString();
}
logger.info(message);
Assert.assertTrue(message.contains("\"desc\":\"无权访问\""),"校验message失败");
Assert.assertTrue(message.contains("\"success\":false"),"校验success失败");
logger.info("校验实物用户id篡改无法兑换成功");
}
@Test(description = "新实物skuId篡改测试")
public void 实物skuId篡改测试() throws Exception{
int uid = 7289;
String appItemId = "197040";
String itemId = "32655" ;
String message = "";
Map cookies = authorization.dafuwengLogin(uid);
//实物兑换,skuId改为其它商品的
try{
Response response = gawService.objectExchange(cookies,appItemId,itemId,"36");
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("校验实物skuId篡改无法兑换成功");
}
......@@ -475,4 +513,10 @@ public class 兑吧新实物_兑换流程测试_ExchangeTest extends CheckTemple
}
......@@ -218,7 +218,6 @@ public class 兑吧老优惠券_兑换流程测试_ExchangeTest extends CheckTem
this.优惠券兑换("174928","30319",uid);
//每日限额用完,无法再次兑换
Thread.sleep(3000);
Map<String,String> map = new HashMap<>();
map.put("appItemId","174928");
map.put("itemId","30319");
......@@ -230,7 +229,7 @@ public class 兑吧老优惠券_兑换流程测试_ExchangeTest extends CheckTem
//获取按钮状态
Response detailResponse = mobileService.detail(authorization.dafuwengLogin(uid),"30319");
detailResponse.prettyPrint();
// detailResponse.prettyPrint();
String exchangeText = MatcherString.getString(detailResponse.asString(), "\"exchangeText\":\"(.*?)\",", 1);
Assert.assertEquals(response.jsonPath().getString("message"),"今日已兑完,明天再来哦(14)","校验message失败");
......
......@@ -576,5 +576,59 @@ public class 自有新优惠券_兑换限制测试_ExchangeTest extends CheckTem
@Test(description = "新优惠券用户id篡改测试")
public void 优惠券用户id篡改测试() throws Exception{
//uid: 大富翁app
//商品: lv测试应用55
int uid = 6999;
String appItemId = "197048";
String message = "";
//优惠券兑换
try{
Response response = gawService.couponExchange(uid,appItemId,175);
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(description = "新优惠券skuId篡改测试")
public void 优惠券skuId篡改测试() throws Exception{
int uid = 7028;
String appItemId = "197048";
String message = "";
//优惠券兑换,skuId改为其它商品的
try{
Response response = gawService.couponExchange(uid,appItemId,105);
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("校验优惠券skuId篡改无法兑换成功");
}
}
......@@ -480,6 +480,58 @@ public class 自有新卡密_兑换限制测试_ExchangeTest extends CheckTemple
@Test(description = "卡密用户id篡改测试")
public void 卡密用户id篡改测试() throws Exception{
//uid: 大富翁app
//商品: lv测试应用55
int uid = 6997;
String appItemId = "197049";
String message = "";
//卡密兑换
try{
Response response = gawService.couponExchange(uid,appItemId,176);
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(description = "卡密skuId篡改测试")
public void 卡密skuId篡改测试() throws Exception{
int uid = 7294;
String appItemId = "197049";
String message = "";
//优惠券兑换,skuId改为其它商品的
try{
Response response = gawService.couponExchange(uid,appItemId,105);
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("校验卡密skuId篡改无法兑换成功");
}
}
package http.cases.ExchangeTest.自有_商品兑换限制;
import http.cases.ExchangeTest.CheckTemplet;
import http.cases.ExchangeTest.Database;
import http.service.Authorization;
import http.service.app.MobileService;
import io.restassured.response.Response;
......@@ -13,6 +14,7 @@ import utils.MatcherString;
import java.lang.reflect.Method;
import java.sql.SQLException;
import java.util.Map;
public class 自有新实物_兑换流程测试_ExchangeTest extends CheckTemplet {
@Autowired
......@@ -34,9 +36,9 @@ public class 自有新实物_兑换流程测试_ExchangeTest extends CheckTemple
Object[][] result = null;
if (method.getName().equals("日期兑换限制测试")) {
result = new Object[][]{
new Object[]{1, "193809", "", "兑吧新实物日期兑换限制未开始"}, //case1
new Object[]{2, "194143", "", "兑吧新实物日期兑换限制进行中"}, //case2
new Object[]{3, "194144", "", "兑吧新实物日期兑换限制已结束"}, //case3
new Object[]{1, "193809", "", "31","兑吧新实物日期兑换限制未开始"}, //case1
new Object[]{2, "194143", "", "72","兑吧新实物日期兑换限制进行中"}, //case2
new Object[]{3, "194144", "", "73", "兑吧新实物日期兑换限制已结束"}, //case3
};
}
return result;
......@@ -61,7 +63,7 @@ public class 自有新实物_兑换流程测试_ExchangeTest extends CheckTemple
}
}
@Test(description = "兑吧新自有实物每人限购---每天限制")
@Test(description = "新自有实物每人限购---每天限制")
public void 每人限购每天限购限制() throws Exception{
String appItemId = "193752";
String itemId = "null";
......@@ -115,7 +117,7 @@ public class 自有新实物_兑换流程测试_ExchangeTest extends CheckTemple
}
}
@Test(description = "兑吧新自有实物每人限购---永久限制")
@Test(description = "新自有实物每人限购---永久限制")
public void 每人限购永久限购限制() throws Exception{
String appItemId = "193802";
String itemId = "null";
......@@ -169,7 +171,9 @@ public class 自有新实物_兑换流程测试_ExchangeTest extends CheckTemple
}
}
@Test(description = "兑吧新自有实物每人限购---周期限制")
@Test(description = "新自有实物每人限购---周期限制")
public void 每人限购周期限制() throws Exception{
String appItemId = "193803";
String itemId = "null";
......@@ -221,7 +225,7 @@ public class 自有新实物_兑换流程测试_ExchangeTest extends CheckTemple
}
@Test(description = "兑吧新自有实物每日限量")
@Test(description = "新自有实物每日限量")
public void 每日限量限制() throws Exception{
String appItemId = "193804";
String itemId = "null";
......@@ -272,22 +276,25 @@ public class 自有新实物_兑换流程测试_ExchangeTest extends CheckTemple
}
}
/**
* @param caseNum 用例编号
* @param appItemId 商品入库Id
* @param itemId 商品id
* @param skuId skuId
* @param caseName 用例名称打印
* @throws Exception
*/
@Test(dataProvider = "providerMethod")
public void 日期兑换限制测试(int caseNum, String appItemId, String itemId, String caseName) throws Exception{
public void 日期兑换限制测试(int caseNum, String appItemId, String itemId, String skuId, String caseName) throws Exception{
String message = "";
logger.info(caseName);
//兑换
try{
Thread.sleep(3000);
Response response = gawService.objectExchange(uid,appItemId,itemId);
Response response = gawService.objectExchange(uid,appItemId,itemId,skuId);
response.prettyPrint();
}catch (Exception e){
message = e.toString();
......@@ -321,7 +328,7 @@ public class 自有新实物_兑换流程测试_ExchangeTest extends CheckTemple
}
@Test(description = "兑吧新自有实物--库存限制")
@Test(description = "新自有实物--库存限制")
public void 库存限制() throws Exception{
String appItemId = "193811";
String itemId = "null";
......@@ -355,18 +362,17 @@ public class 自有新实物_兑换流程测试_ExchangeTest extends CheckTemple
}
@Test(description = "兑吧新自有实物会员兑换限制")
@Test(description = "新自有实物会员兑换限制")
public void 会员兑换限制() throws Exception{
String appItemId = "193810";
String itemId = "null";
String message = "";
String skuId="27";
String skuId="32";
//会员等级无法兑换
try{
//会员等级可兑换,vip=5
Thread.sleep(3000);
Response response =gawService.objectExchange(uid,appItemId,itemId);
Response response =gawService.objectExchange(uid,appItemId,itemId,skuId);
response.prettyPrint();
}catch (Exception e){
......@@ -381,6 +387,119 @@ public class 自有新实物_兑换流程测试_ExchangeTest extends CheckTemple
}
@Test(description = "新实物确认下单页面")
public void 实物确认下单测试() throws Exception{
int uid = 7290;
String appItemId = "196218";
String appSkuId = "145";
Response response = gawService.confirmItemDetail(uid,appItemId,appSkuId);
response.prettyPrint();
Assert.assertEquals(response.jsonPath().getString("data.items[0].sku.attr[0].value"),"白色","校验sku信息颜色失败");
Assert.assertEquals(response.jsonPath().getString("data.items[0].sku.attr[1].value"),"S","校验sku信息尺寸失败");
Assert.assertEquals(response.jsonPath().getString("data.items[0].sku.credits"),"100","校验sku商品积分失败");
Assert.assertEquals(response.jsonPath().getString("data.items[0].multiImage"),"//yun.dui88.com/images/201906/9p72lmu1qn.jpg","校验图片信息失败");
Assert.assertEquals(response.jsonPath().getString("data.items[0].title"),"【自动化勿动】自有实物sku","校验实物名称失败");
Assert.assertEquals(response.jsonPath().getString("data.orderCredits"),"100","校验订单积分失败");
Assert.assertEquals(response.jsonPath().getString("data.expressPrice"),"500","校验订单运费金额失败");
Assert.assertEquals(response.jsonPath().getString("data.consumerPayPrice"),"500","校验订单支付金额失败");
logger.info("校验新实物确认下单页正确");
}
@Test(description = "新实物用户id篡改测试")
public void 实物用户id篡改测试() throws Exception{
//uid: 大富翁app
//商品: lv测试应用55
int uid = 7204;
String appItemId = "197041";
String itemId = null ;
String skuId = "159";
String message = "";
//实物兑换
try{
Response response =gawService.objectExchange(uid,appItemId,itemId,skuId);
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(description = "新实物积分修改测试")
public void 实物积分篡改测试() throws Exception{
int uid = 7288;
String appItemId = "197041";
String itemId = null ;
String skuId = "159";
//实物兑换,积分传0
Response response =gawService.objectExchange(uid,appItemId,itemId,skuId,"0","0");
response.prettyPrint();
String orderId = response.jsonPath().getString("data.orderId");
//查询数据库
Thread.sleep(3000);
Map<String,Object> mapOrderId = jdbc.findSimpleResult("SELECT * FROM "+ Database.orders_consumer+"."+ Database.orders14 + " where id = " + orderId);
String orderStatus = String.valueOf(mapOrderId.get("status"));
String orderCredits = String.valueOf(mapOrderId.get("credits"));
logger.info("订单积分:" + orderCredits);
Assert.assertEquals(orderStatus,"consume_success","校验status失败");
Assert.assertEquals(orderCredits,"100","校验credits失败");
logger.info("校验实物积分篡改兑换成功");
}
@Test(description = "新实物skuId篡改测试")
public void 实物skuId篡改测试() throws Exception{
int uid = 7288;
String appItemId = "197042";
String itemId = null ;
String message = "";
Map cookies = authorization.dafuwengLogin(uid);
//实物兑换,skuId改为其它商品的
try{
Response response = gawService.objectExchange(cookies,appItemId,itemId,"36");
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("校验实物skuId篡改无法兑换成功");
}
//测试使用
//@Test(enabled=true, dataProvider="testdp", threadPoolSize=1, invocationCount=100)
@DataProvider(name = "testdp", parallel = true)
......@@ -399,6 +518,8 @@ public class 自有新实物_兑换流程测试_ExchangeTest extends CheckTemple
};
}
// @Test(enabled=true, dataProvider="testdp", threadPoolSize=1, invocationCount=100)
public void test(int uid) throws Exception {
// System.out.println("Current Thread Id: " + Thread.currentThread().getId() + ". Dataprovider number: "+ dpNumber);
......
......@@ -443,4 +443,61 @@ public class 自有新虚拟商品_充值_兑换限制_ExchangeTest extends Chec
}
@Test(description = "新虚拟商品用户id篡改测试")
public void 虚拟商品用户id篡改测试() throws Exception{
//uid: 大富翁app
//商品: lv测试应用55
int uid = 6970;
String appItemId = "197050";
String message = "";
Map cookies = authorization.dafuwengLogin(uid);
//虚拟商品兑换
try{
Response response = gawService.virtualExchange(cookies, appItemId,177);
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(description = "新虚拟商品skuId篡改测试")
public void 虚拟商品skuId篡改测试() throws Exception{
int uid = 7295;
String appItemId = "197050";
String message = "";
Map cookies = authorization.dafuwengLogin(uid);
//优惠券兑换,skuId改为其它商品的
try{
Response response = gawService.virtualExchange(cookies, appItemId,105);
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("校验虚拟商品skuId篡改无法兑换成功");
}
}
......@@ -201,7 +201,7 @@ public class 秒杀商品_自有新优惠券_兑换限制_SeckillTest extends Du
@Test(description = "优惠券--活动未开始")
public void 优惠券活动未开始() throws Exception{
String appItemId="195542";
String appItemId="195541";
String itemId=null;
String message = "";
String actId = "29";
......@@ -240,7 +240,7 @@ public class 秒杀商品_自有新优惠券_兑换限制_SeckillTest extends Du
@Test(description = "优惠券--活动已结束")
public void 优惠券活动已结束() throws Exception{
String appItemId="195543";
String appItemId="195542";
String itemId=null;
String message = "";
String actId = "30";
......
......@@ -53,6 +53,13 @@ public class 商品分组组件_DuibaTest extends DuibaTestBase {
new Object[]{2, "2104", "商品分组-自有新商品"}, //case2
};
}
if (method.getName().equals("手机端商品分组组件老商品展示")){
result = new Object[][]{
new Object[]{1, "2124", "商品分组-兑吧老商品"}, //case1
new Object[]{2, "2125", "商品分组-自有老商品"}, //case2
};
}
return result;
}
......@@ -177,7 +184,7 @@ public class 商品分组组件_DuibaTest extends DuibaTestBase {
/**
/**
* @param caseNum 用例编号
* @param classifyId 商品分组Id
* @param caseName 用例名称打印
......@@ -239,5 +246,68 @@ public class 商品分组组件_DuibaTest extends DuibaTestBase {
/**
* @param caseNum 用例编号
* @param classifyId 商品分组Id
* @param caseName 用例名称打印
* @throws Exception
*/
@Test(dataProvider = "providerMethod")
public void 手机端商品分组组件老商品展示(int caseNum, String classifyId, String caseName) throws Exception{
logger.info("---" + caseName + "---");
//app:lv测试应用33
Map cookies = authorization.dafuwengLogin(6569);
Response response = chwVisualEditorService.itemsList(cookies,classifyId);
response.prettyPrint();
switch (caseNum){
case 1:
//手机端接口排序与前端不一致
Assert.assertEquals(response.jsonPath().getString("data.list[0].title"),"【自动化勿动】兑吧新优惠券普通券码跳转","校验第一个商品title失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].titleDownTxt"),"100积分","校验第一个商品credits失败");
Assert.assertEquals(response.jsonPath().getString("data.list[1].title"),"【自动化勿动】兑吧卡密跳转按钮","校验第二个商品title失败");
Assert.assertEquals(response.jsonPath().getString("data.list[1].titleDownTxt"),"200积分","校验第二个商品credits失败");
Assert.assertEquals(response.jsonPath().getString("data.list[2].title"),"【自动化勿动】兑吧新实物","校验第三个商品title失败");
Assert.assertEquals(response.jsonPath().getString("data.list[2].titleDownTxt"),"300积分","校验第三个商品credits失败");
Assert.assertEquals(response.jsonPath().getString("data.list[3].title"),"支付宝充值","校验第四个商品title失败");
Assert.assertEquals(response.jsonPath().getString("data.list[3].titleDownTxt"),"10万积分","校验第四个商品credits失败");
Assert.assertEquals(response.jsonPath().getString("data.list[4].title"),"10元话费","校验第五个商品title失败");
Assert.assertEquals(response.jsonPath().getString("data.list[4].titleDownTxt"),"1000积分","校验第五个商品credits失败");
logger.info("校验商品分组1-兑吧新商品成功");
break;
case 2:
Assert.assertEquals(response.jsonPath().getString("data.list[0].title"),"【自动化勿动】自有新优惠券跳转链接","校验第一个商品title失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].titleDownTxt"),"100积分","校验第一个商品credits失败");
Assert.assertEquals(response.jsonPath().getString("data.list[1].title"),"【自动化勿动】自有新实物加钱购","校验第二个商品title失败");
Assert.assertEquals(response.jsonPath().getString("data.list[1].titleDownTxt"),"150积分&nbsp;+&nbsp;10.00元","校验第二个商品credits失败");
Assert.assertEquals(response.jsonPath().getString("data.list[2].title"),"【自动化勿动】自有充值商品","校验第三个商品title失败");
Assert.assertEquals(response.jsonPath().getString("data.list[2].titleDownTxt"),"300积分","校验第三个商品credits失败");
Assert.assertEquals(response.jsonPath().getString("data.list[3].title"),"【自动化勿动】自有卡密","校验第四个商品title失败");
Assert.assertEquals(response.jsonPath().getString("data.list[3].titleDownTxt"),"550积分","校验第四个商品credits失败");
logger.info("校验商品分组2-自有新商品成功");
break;
}
}
}
......@@ -31,13 +31,13 @@ public class gawService {
//普通实物兑换接口
public Response objectExchange(int uid, String appItemId,String itemId) throws Exception {
public Response objectExchange(int uid, String appItemId,String itemId, String skuId) throws Exception {
Map<String,Object> map = new HashMap<>();
Map<String,Object> mapList = new HashMap<>();
List<Map> list = new ArrayList<>();
mapList.put("itemId",itemId);
mapList.put("skuId",16);
mapList.put("skuId",skuId);
mapList.put("appItemId",appItemId);
mapList.put("credits","100");
mapList.put("price",0);
......@@ -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> mapList = new HashMap<>();
List<Map> list = new ArrayList<>();
mapList.put("itemId",itemId);
mapList.put("skuId",skuId);
mapList.put("appItemId",appItemId);
mapList.put("credits","100");
mapList.put("credits",credits);
mapList.put("price",0);
list.add(mapList);
......@@ -139,7 +141,7 @@ public class gawService {
map.put("remark",""); //买家留言
map.put("degreeId","");
map.put("actualPrice","0"); //总金额
map.put("actualCredits","100"); //总积分
map.put("actualCredits",actualCredits); //总积分
map.put("itemParam",list.toArray());
map.put("payType","3");
map.put("expressPrice","0");
......@@ -148,8 +150,8 @@ public class gawService {
JSONObject jsonParam = JSONObject.parseObject(JSON.toJSONString(map));
logger.info("请求实物兑换接口:"+ "/gaw/couponExchange/create");
Response response = given().contentType("application/json; charset=UTF-8").cookies(authorization.dafuwengLogin(uid)).body(jsonParam).post("http://"+goodsHost+"/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/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 {
}
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> mapList = new HashMap<>();
List<Map> list = new ArrayList<>();
mapList.put("itemId",itemId);
mapList.put("skuId",skuId);
mapList.put("appItemId",appItemId);
mapList.put("credits","100");
......@@ -183,38 +211,44 @@ public class gawService {
map.put("remark",""); //买家留言
map.put("degreeId","");
map.put("actualPrice","0"); //总金额
map.put("actualCredits","100"); //总积分
map.put("itemParam",list.toArray());
map.put("payType","3");
map.put("expressPrice","0");
map.put("validate","");
map.put("token","yrJRr7Cddp2YeQd");
JSONObject jsonParam = JSONObject.parseObject(JSON.toJSONString(map));
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{
Assert.assertEquals(response.jsonPath().getString("success"),"true");
}catch(Exception e){
throw new Exception("/gaw/couponExchange/create接口返回异常,返回信息:"+response.asString());
throw new Exception("/gaw/objectExchange/create接口返回异常,返回信息:"+response.asString());
}catch(Error er){
throw new Exception("/gaw/couponExchange/create接口返回异常,返回信息:"+response.asString());
throw new Exception("/gaw/objectExchange/create接口返回异常,返回信息:"+response.asString());
}
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> mapList = new HashMap<>();
List<Map> list = new ArrayList<>();
mapList.put("itemId",itemId);
mapList.put("skuId",skuId);
mapList.put("appItemId",appItemId);
mapList.put("credits","100");
......@@ -223,39 +257,34 @@ public class gawService {
map.put("remark",""); //买家留言
map.put("degreeId","");
map.put("actualPrice","0"); //总金额
map.put("actualCredits","100"); //总积分
map.put("itemParam",list.toArray());
map.put("payType","3");
map.put("expressPrice","0");
map.put("validate","");
map.put("token","yrJRr7Cddp2YeQd");
JSONObject jsonParam = JSONObject.parseObject(JSON.toJSONString(map));
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 saveResponse = given().contentType("application/x-www-form-urlencoded;charset=UTF-8").cookies(authorization.dafuwengLogin(uid)).params(map).post("http://"+goodsHost+"/gaw/objectExchange/create");
Response response = given().contentType("application/json; charset=UTF-8").cookies(cookies).body(jsonParam).post("http://"+goodsHost+"/gaw/couponExchange/create");
// response.prettyPrint();
try{
Assert.assertEquals(response.jsonPath().getString("success"),"true");
}catch(Exception e){
throw new Exception("/gaw/objectExchange/create接口返回异常,返回信息:"+response.asString());
throw new Exception("/gaw/couponExchange/create接口返回异常,返回信息:"+response.asString());
}catch(Error er){
throw new Exception("/gaw/objectExchange/create接口返回异常,返回信息:"+response.asString());
throw new Exception("/gaw/couponExchange/create接口返回异常,返回信息:"+response.asString());
}
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> mapList = new HashMap<>();
......@@ -280,7 +309,7 @@ public class gawService {
JSONObject jsonParam = JSONObject.parseObject(JSON.toJSONString(map));
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");
......@@ -299,17 +328,15 @@ public class gawService {
}
//普通自有新实物兑换接口
public Response objectExchange(int uid, String appItemId,String itemId,String skuId,String credits,String actualCredits ) throws Exception {
//虚拟商品兑换接口
public Response virtualExchange(Map cookie, String appItemId,int skuId) throws Exception {
Map<String,Object> map = new HashMap<>();
Map<String,Object> mapList = new HashMap<>();
List<Map> list = new ArrayList<>();
mapList.put("itemId",itemId);
mapList.put("skuId",skuId);
mapList.put("appItemId",appItemId);
mapList.put("credits",credits);
mapList.put("credits","100");
mapList.put("price",0);
list.add(mapList);
......@@ -317,7 +344,7 @@ public class gawService {
map.put("remark",""); //买家留言
map.put("degreeId","");
map.put("actualPrice","0"); //总金额
map.put("actualCredits",actualCredits); //总积分
map.put("actualCredits","100"); //总积分
map.put("itemParam",list.toArray());
map.put("payType","3");
map.put("expressPrice","0");
......@@ -326,8 +353,8 @@ public class gawService {
JSONObject jsonParam = JSONObject.parseObject(JSON.toJSONString(map));
logger.info("请求实物兑换接口:"+ "/gaw/objectExchange/create");
Response response = given().contentType("application/json; charset=UTF-8").cookies(authorization.dafuwengLogin(uid)).body(jsonParam).post("http://"+goodsHost+"/gaw/objectExchange/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 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 {
}
return response;
}
......@@ -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;
}
}
......@@ -60,6 +60,7 @@ public class RedisUtil {
map.put("key",key);
Response response = given().params(map).get("http://activity.m.duibatest.com.cn/seedRedPacket/clearObjectKey");
response.prettyPrint();
}
public static void main(String[] args) {
......
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