Commit cef646ff authored by 赵然's avatar 赵然

Merge branch 'develop'

parents 34cd3713 8f587fbc
......@@ -79,7 +79,7 @@ public class 插件场景测试_pluginTest extends DuibaTestBase {
}else
if(method.getName().equals("插件触发事件测试")){
result = new Object[][]{
// new Object[]{1,"0","chome","插件触发事件有效期内首次访问"},
new Object[]{1,"0","chome","插件触发事件有效期内首次访问"},
new Object[]{2,"4","chome","插件触发事件未登录用户访问"},
};
......
......@@ -70,7 +70,7 @@ public class 补给站_活动_DuibaTest extends AbstractTestNGSpringContextTests
public void b_添加签到活动() throws Exception{
//查询热门活动-活动列表,获取商品ID
Response response=developerBJZ.saasActivitys("2",appId);
String goodItemId= String.valueOf(response.jsonPath().getString("data.saasActivitys[1].id"));
String goodItemId= String.valueOf(response.jsonPath().getString("data.saasActivitys[0].id"));
//获取商品ID,进入商品订购页面,获取SKU
Response response2=developerBJZ.itemOrderDetail(goodItemId,appId);
String skuId= String.valueOf(response2.jsonPath().getString("data.goodsItemSku[0].skuId"));
......@@ -92,7 +92,7 @@ public class 补给站_活动_DuibaTest extends AbstractTestNGSpringContextTests
public void c_待处理的订单() throws Exception{
//查询热门活动-活动列表,获取商品ID
Response response=developerBJZ.saasActivitys("2",appId);
String goodItemId= String.valueOf(response.jsonPath().getString("data.saasActivitys[1].id"));
String goodItemId= String.valueOf(response.jsonPath().getString("data.saasActivitys[0].id"));
//获取商品ID,进入商品订购页面,获取SKU
Response response2=developerBJZ.itemOrderDetail(goodItemId,appId);
String skuId= String.valueOf(response2.jsonPath().getString("data.goodsItemSku[0].skuId"));
......
......@@ -30,6 +30,7 @@ public class 开发者签到编辑_signTest extends AbstractTestNGSpringContextT
Assert.assertEquals(response.jsonPath().getString("data.list[0].openToDev"),"false","来自Duiba的签到编辑权限失败");
Assert.assertEquals(response.jsonPath().getString("data.list[1].openToDev"),"true","来自开发者自有的签到编辑权限失败");
Assert.assertEquals(response.jsonPath().getString("data.list[2].openToDev"),"true","来自开发者自有的签到编辑权限失败");
logger.info("开发者签到编辑权限校验成功");
}
......
package http.service.Activity;
import base.DuibaLog;
import http.service.Authorization;
import io.restassured.response.Response;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.testng.Assert;
import java.util.HashMap;
import java.util.Map;
import static io.restassured.RestAssured.given;
/**
* Created by zhaoran on 2019/03/29
*/
@Service
public class GlobalRewardService {
@Autowired
Authorization authorization;
@Value("${activity.host}")
String activityHost;
private DuibaLog logger = DuibaLog.getLogger();
/**
* 获取红包账户
* @param cookies
* @return
* @throws Exception
*/
public Response getWalletAccount(Map cookies) throws Exception {
logger.info("请求getWalletAccount");
Response response = given().cookies(cookies).get(activityHost+"/walletAccount/getWalletAccount");
try{
Assert.assertEquals(response.jsonPath().getString("success"),"true","/walletAccount/getWalletAccount接口失败");
}catch(Exception e){
throw new Exception("/walletAccount/getWalletAccount接口失败,返回信息:"+response.asString());
}catch(Error er){
throw new Exception("/walletAccount/getWalletAccount接口失败,返回信息:"+response.asString());
}
return response;
}
/**
* 红包账户提现
* @param cookies
* @param amount
* @param account
* @param username
* @return
* @throws Exception
*/
public Response withdraw(Map cookies,String amount,String account,String username) throws Exception {
logger.info("请求withdraw");
Map<String,String> map = new HashMap<>();
map.put("amount",amount);
map.put("account",account);
map.put("username",username);
Response response = given().contentType("application/x-www-form-urlencoded;charset=UTF-8").cookies(cookies).params(map).post(activityHost+"/globalReward/withdraw");
try{
Assert.assertEquals(response.jsonPath().getString("success"),"true","/walletAccount/doTakePrize接口失败");
}catch(Exception e){
throw new Exception("/globalReward/withdraw接口失败,返回信息:"+response.asString());
}catch(Error er){
throw new Exception("/globalReward/withdraw接口失败,返回信息:"+response.asString());
}
return response;
}
/**
* 红包账户提现
* @param cookies
* @param orderId
* @return
* @throws Exception
*/
public Response getOrderStatus(Map cookies,String orderId) throws Exception {
logger.info("请求getOrderStatus");
Map<String,String> map = new HashMap<>();
map.put("orderId",orderId);
Response response = given().cookies(cookies).params(map).post(activityHost+"/walletAccount/getOrderStatus");
try{
Assert.assertEquals(response.jsonPath().getString("success"),"true","/walletAccount/getOrderStatus接口失败");
}catch(Exception e){
throw new Exception("/walletAccount/getOrderStatus接口失败,返回信息:"+response.asString());
}catch(Error er){
throw new Exception("/walletAccount/getOrderStatus接口失败,返回信息:"+response.asString());
}
return response;
}
public Response getOrderStatus2(Map cookies,String orderId) throws Exception {
logger.info("请求getOrderStatus");
Map<String,String> map = new HashMap<>();
map.put("orderId",orderId);
Response response = given().cookies(cookies).params(map).post(activityHost+"/walletAccount/getOrderStatus");
return response;
}
/**
* 红包账户提现记录
* @param cookies
* @return
* @throws Exception
*/
public Response walletDetail(Map cookies) throws Exception {
logger.info("请求walletDetail");
Map<String,String> map = new HashMap<>();
map.put("pageNo","1");
map.put("pageSize","12");
Response response = given().cookies(cookies).params(map).get(activityHost+"/walletAccount/walletDetail");
try{
Assert.assertEquals(response.jsonPath().getString("success"),"true","/walletAccount/walletDetail接口失败");
}catch(Exception e){
throw new Exception("/walletAccount/walletDetail接口失败,返回信息:"+response.asString());
}catch(Error er){
throw new Exception("/walletAccount/walletDetail接口失败,返回信息:"+response.asString());
}
return response;
}
/**
* 红包账户修改钱包账户余额后门
* @param consumerId
* @param accountType
* @param balanceAmount
* @return
* @throws Exception
*/
public void updateConsumerAccount(String consumerId,String accountType,String balanceAmount) throws Exception {
logger.info("请求修改钱包账户余额后门:updateConsumerAccount");
Map<String,String> map = new HashMap<>();
map.put("consumerId",consumerId);
map.put("accountType",accountType);
map.put("balanceAmount",balanceAmount);
Response response = given().params(map).get(activityHost+"/aaw/automated/updateConsumerAccount");
// try{
// Assert.assertEquals(response.jsonPath().getString("success"),"true","/walletAccount/walletDetail接口失败");
//
// }catch(Exception e){
// throw new Exception("/aaw/automated/updateConsumerAccount接口失败,返回信息:"+response.asString());
// }catch(Error er){
// throw new Exception("/aaw/automated/updateConsumerAccount接口失败,返回信息:"+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