Commit 175c5d47 authored by qwj-github's avatar qwj-github

add

parent 1e7f8a1b
......@@ -306,6 +306,7 @@ public class pk_押注测试_AccessTest extends DuibaTestBase {
doJoinResponse.prettyPrint();
Assert.assertEquals(doJoinResponse.jsonPath().getString("code").toString(),"100060");
clear(consumerIds);
}
......
......@@ -12,15 +12,19 @@ import base.DuibaTestBase;
import com.alibaba.fastjson.JSONObject;
import http.model.PkPopPrizeVo;
import http.service.Activity.PkService;
import http.service.Manager.EditManagerInfoService;
import http.service.Manager.PkActivityService;
import http.service.hd.DeveloperConfigService;
import io.restassured.response.Response;
import org.springframework.beans.factory.annotation.Autowired;
import org.testng.Assert;
import org.testng.annotations.AfterClass;
import org.testng.annotations.Test;
import utils.GetCookieUtil;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
......@@ -38,6 +42,12 @@ public class pk_瓜分红包_发券测试 extends DuibaTestBase {
PkService pkService;
@Autowired
PkActivityService pkActivityService;
@Autowired
DeveloperConfigService developerConfigService;
@Autowired
EditManagerInfoService editManagerInfoService;
private static DuibaLog logger = DuibaLog.getLogger();
......@@ -52,6 +62,7 @@ public class pk_瓜分红包_发券测试 extends DuibaTestBase {
// private Integer user04 = 5450;//appid=21982
List<String> newBetIds = new ArrayList<>();
private String consumerIds = "";
......@@ -109,6 +120,30 @@ public class pk_瓜分红包_发券测试 extends DuibaTestBase {
}
}
@Test
public void 押注_新用户首次参与测试() throws Exception{
Map<String,String> user = this.createUser();
consumerIds = user.get("consumerId");
logger.info("consumerIds的信息为"+consumerIds);
String newBetId = "";
List<String> optionsIds = new ArrayList<>();
String groupId = "200";
newBetId = createPk("2","2020-08-12 00:00:00",groupId);
newBetIds.add(newBetId);
List<Map<String,Object>> pks = jdbc.findModeResult("select * from act_com_conf.tb_bet_option where bet_id = ?",newBetId);
logger.info("pk活动信息为"+JSONObject.toJSONString(pks));
for (int i=0;i<pks.size();i++){
optionsIds.add(pks.get(i).get("id").toString());
}
logger.info("pk活动id为:"+newBetId+",选项id为:"+ optionsIds.toString());
Response doJoinResponse = pkService.doJoin2(Integer.valueOf(user.get("uid")),newBetId,optionsIds.get(0));
doJoinResponse.prettyPrint();
Assert.assertEquals(doJoinResponse.jsonPath().getString("code").toString(),"100060");
}
public String createPk(String bounsType,String endTime,String groupId) throws Exception {
......@@ -132,7 +167,30 @@ public class pk_瓜分红包_发券测试 extends DuibaTestBase {
}
@AfterClass
public Map<String,String> createUser() throws Exception{
Map<String,String> map = new HashMap<>();
Response response = editManagerInfoService.createUser("pk活动首次参与用户发券","103");
Map<String,Object> user = jdbc.findSimpleResult("select * from dafuweng.user where name = 'pk活动首次参与用户发券' and app_id = '103'\n");
String uid = user.get("id").toString();
String url = GetCookieUtil.genUrl(uid,"3NhqvHsNBDfcAJBUvdxmAs8mHq2d");
JSONObject cookie = GetCookieUtil.getConsumerIdFromCookie(url);
map.put("uid",uid);
map.put("consumerId",cookie.get("cid").toString());
logger.info("用户信息为,uid="+uid+"consumerId="+cookie.get("cid").toString());
return map;
}
public void clear(String comsumerIds) throws Exception{
Boolean res = jdbc.update("delete from dafuweng.user where name = 'pk活动首次参与用户' and app_id = '103'");
String dbName = "new_consumer.consumer_"+ String.format("%04d", Long.parseLong(comsumerIds)/10000000);
logger.info("用户的分表名dbName为"+dbName);
Boolean res1 = jdbc.update("delete from "+dbName+" where id = ?",comsumerIds);
}
// @AfterClass
public void tearDown() {
try {
......@@ -146,6 +204,8 @@ public class pk_瓜分红包_发券测试 extends DuibaTestBase {
}
clear(consumerIds);
} catch (SQLException e) {
e.printStackTrace();
} catch (Exception e){
......
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