Commit c0c2b7ba authored by 周松波's avatar 周松波

fix

parent 604ffa95
......@@ -39,7 +39,7 @@ public class ContractSign_signTest extends DuibaTestBase {
ManagerService managerService;
@Value("${activity.host}")
String activityHost;
String period;
// private static DuibaLog logger = DuibaLog.getLogger();
//指定用户
......@@ -103,7 +103,7 @@ public class ContractSign_signTest extends DuibaTestBase {
// 期次开始的时间 yyyy-MM-dd格式
String startTime = format.format(date);
// 期次号 MMDD格式
String period = format2.format(date);
period = format2.format(date);
calendar.add(Calendar.DAY_OF_YEAR, 6);
date = calendar.getTime();
// 期次结束时间
......@@ -223,8 +223,49 @@ public class ContractSign_signTest extends DuibaTestBase {
//@Test(description = "开奖,活动ID=2",priority = 5)
public void 契约开奖() throws Exception{
//修改redis的打卡日期键值
String actId = "2";
Response res = ContractSignService.getContracts(actId, uid2);
String issueId = res.jsonPath().getString("data.list[0].issueId");
Date now = new Date();
SimpleDateFormat sdf = new SimpleDateFormat("yy-MM-dd");
String today = sdf.format(now);
Calendar calendar = Calendar.getInstance();
calendar.setTime(now);
calendar.add(Calendar.DAY_OF_YEAR, -1);
String yestertoday = sdf.format(calendar.getTime());
String oldKey = String.format("SIGNCENTER_K030_%s_%s", issueId, today);
String newKey = String.format("SIGNCENTER_k030_%s_%s", issueId, yestertoday);
Map<String, String> map = new HashMap<>();
map.put("key", oldKey);
map.put("newKey", newKey);
Response response = given().params(map).get(activityHost + "/signtest/redis/renameKey");
String result = response.jsonPath().getString("success");
Assert.assertEquals(result, "true", "重命名redis键值失败");
// 查询下期是否开始
Response homeInfoRes = ContractSignService.getHomeInfo(actId, uid3);
homeInfoRes.prettyPrint();
String periodShow = homeInfoRes.jsonPath().getString("data.periodShow");
Assert.assertEquals(periodShow, period, "参与期次号不正确");
String status = homeInfoRes.jsonPath().getString("data.status");
Assert.assertEquals(status, "0", "当前参与状态不正确");
// 查询中奖信息
Response recordRes = ContractSignService.getContracts(actId, uid3);
String contractId = recordRes.jsonPath().getString("data.list[0].contractId");
String doneStatus = recordRes.jsonPath().getString("data.list[0].doneStatus");
Assert.assertEquals(doneStatus, "WAIT_REWARD", "当前期次完成状态不正确");
String winCount = recordRes.jsonPath().getString("data.list[0].winCount");
Assert.assertEquals(winCount, "7000", "瓜分奖励金额不正确");
// 领奖
Response rewardRes = ContractSignService.getReward(contractId,uid3);
String rewardStatus = rewardRes.jsonPath().getString("success");
String rewardAmount = rewardRes.jsonPath().getString("data");
Assert.assertEquals(rewardStatus,"true","领取奖励结果不正确");
Assert.assertEquals(rewardAmount,winCount,"领取奖励金额不正确");
}
public Map<String, String> doJoinResult(String activityId, String betAmount, int uid) throws Exception {
Response doJoinRes = ContractSignService.doJoin(activityId, betAmount, uid);
String contractId = doJoinRes.jsonPath().getString("data.contractId");
......
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