Commit 88a487ef authored by 赵然's avatar 赵然

zr

parent a1f7764f
package http.cases.WalletTest;
import base.DuibaLog;
import base.DuibaTestBase;
import http.service.Activity.SeedRedPacketService;
import http.service.Activity.WalletAccountService;
import http.service.Authorization;
import io.restassured.response.Response;
import org.springframework.beans.factory.annotation.Autowired;
import org.testng.Assert;
import org.testng.annotations.Test;
import utils.RedisUtil;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
/**
* Created by mabo on 2018/8/15
*/
public class 种红包发券 extends DuibaTestBase{
@Autowired
SeedRedPacketService seedRedPacketService;
@Autowired
WalletAccountService walletAccountService;
@Autowired
Authorization authorization;
private DuibaLog logger = DuibaLog.getLogger();
//指定用户
private static int uid = 4689;
private static int uid2 = 4552;
@Test
public void 出券开关校验_() throws Exception {
//dafuweng登陆获取cookies
Map cookies = authorization.dafuwengLogin(uid);
//校验种红包配置
Response response = seedRedPacketService.getExtConfig(cookies);
String adPositions = response.jsonPath().getString("data.adPositions");
String adSwitch = response.jsonPath().getString("data.adSwitch");
String drawNumDaily = response.jsonPath().getString("data.drawNumDaily");
Assert.assertEquals(adPositions,"1,2,3","发券位置校验异常");
Assert.assertEquals(adSwitch,"true","种红包开关校验异常");
Assert.assertEquals(drawNumDaily,"20","每日中奖个数校验异常");
}
@Test
public void 出券开关校验_() throws Exception {
//dafuweng登陆获取cookies
Map cookies = authorization.dafuwengLogin(uid2);
//校验种红包配置
Response response = seedRedPacketService.getExtConfig(cookies);
String adPositions = response.jsonPath().getString("data.adPositions");
String adSwitch = response.jsonPath().getString("data.adSwitch");
Assert.assertNull(adPositions,"发券位置校验异常");
Assert.assertEquals(adSwitch,"false","种红包开关校验异常");
}
}
......@@ -131,6 +131,21 @@ public class SeedRedPacketService {
return response;
}
public Response getExtConfig(Map cookies) throws Exception {
logger.info("请求getExtConfig接口");
Response response = given().cookies(cookies).get(activityHost+"/seedRedPacket/getExtConfig");
try{
Assert.assertEquals(response.jsonPath().getString("success"),"true","/seedRedPacket/getExtConfig接口失败");
}catch(Exception e){
throw new Exception("/seedRedPacket/getExtConfig接口失败,返回信息:"+response.asString());
}catch(Error er){
throw new Exception("/seedRedPacket/getExtConfig接口失败,返回信息:"+response.asString());
}
return response;
}
/**
* 修改土地解锁状态后门
* @param appId
......
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