Commit 8769cb94 authored by 吕雯燕's avatar 吕雯燕

lv

parent 0a2ecc98
......@@ -32,38 +32,50 @@ public class 积分夺宝开奖_AccessTest extends DuibaTestBase {
}
@Test
@Test(description = "夺宝码开奖,领奖优惠券奖品")
public void 夺宝领奖() throws Exception{
//手动触发开奖
int uid = 7396;
String activityId = "45465";
String detailId = "6";
String basicId = "5";
String phaseId = "12";
//手动触发开奖
Response response = happyCodeNewService.openPrize(uid);
response.prettyPrint();
//查询数据库表,已开奖-3,开奖后才能领奖
Map map = jdbc.findSimpleResult("SELECT * FROM act_com_conf.`tb_happy_code_item_phase` where id = 12");
String phase_status = String.valueOf(map.get("phase_status"));
String winner_id = String.valueOf(map.get("winner_id"));
String win_code = String.valueOf(map.get("win_code"));
logger.info("领奖状态:" + phase_status);
logger.info("中奖用户id:" + winner_id);
logger.info("中奖用户夺宝码:" + win_code);
Assert.assertEquals(phase_status,"3","校验phase_status期次状态失败");
//领奖
Response rewardResponse = happyCodeNewService.getReward(uid,activityId,detailId);
rewardResponse.prettyPrint();
Response response = happyCodeNewService.getReward(uid,activityId,detailId);
response.prettyPrint();
//夺宝详情页面
Response detailResponse = happyCodeNewService.detail(uid,activityId,basicId,phaseId);
detailResponse.prettyPrint();
String phaseStatus = String.valueOf(detailResponse.jsonPath().getString("data.phaseStatus"));
String prizeCode = String.valueOf(detailResponse.jsonPath().getString("data.prizeCode"));
String prizeType = String.valueOf(detailResponse.jsonPath().getString("data.prizeType"));
String rewardStatus = String.valueOf(detailResponse.jsonPath().getString("data.rewardStatus"));
//校验数据库与夺宝详情数据
map = jdbc.findSimpleResult("SELECT * FROM act_com_conf.`tb_happy_code_item_phase` where id = 12");
phase_status = String.valueOf(map.get("phase_status"));
String winner_id = String.valueOf(map.get("winner_id"));
String win_code = String.valueOf(map.get("win_code"));
logger.info("中奖用户id:" + winner_id);
logger.info("中奖用户夺宝码:" + win_code);
Assert.assertEquals(phaseStatus,phase_status,"校验phase_status期次状态失败");
Assert.assertEquals(prizeCode,win_code,"校验prizeCode中奖夺宝码失败");
Assert.assertEquals(prizeType,"coupon","校验prizeType失败");
Assert.assertEquals(rewardStatus,"2","校验rewardStatus失败");
Assert.assertEquals(winner_id,"100164126","校验中奖用户id失败");
logger.info("校验夺宝码开奖成功");
}
}
......@@ -16,6 +16,7 @@ import java.util.List;
import java.util.Map;
import static io.restassured.RestAssured.given;
import static io.restassured.RestAssured.trustStore;
/**
* Created by lvwenyan on 2019/11/23
......@@ -140,6 +141,28 @@ public class HappyCodeNewService {
return response;
}
/**
* 手动触发定时任务开奖接口
* @param uid 用户id
*/
public Response openPrize(int uid) throws Exception {
logger.info("请求/aaw/happyCodeNew/openPrize");
Response response = given().cookies(authorization.dafuwengLogin(uid)).get(activityHost + "/aaw/happyCodeNew/openPrize");
try {
Assert.assertEquals(response.jsonPath().getString("success"), "true", "/aaw/happyCodeNew/openPrize接口失败");
} catch (Exception e) {
throw new Exception("/aaw/happyCodeNew/openPrize接口失败,返回信息:" + response.asString());
} catch (Error er) {
throw new Exception("/aaw/happyCodeNew/openPrize接口失败,返回信息:" + 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