Commit 7c8a0b40 authored by 赵然's avatar 赵然

zr

parent 86458923
......@@ -10,34 +10,59 @@ package http.cases.PkMoudleTest;
import base.DuibaLog;
import base.DuibaTestBase;
import http.service.Activity.PkMoudleService;
import http.service.Activity.PkService;
import http.service.hd.PkDevelopService;
import io.restassured.response.Response;
import org.springframework.beans.factory.annotation.Autowired;
import org.testng.Assert;
import org.testng.annotations.Test;
import java.math.BigDecimal;
public class 瓜分积分_AccessTest extends DuibaTestBase {
@Autowired
PkMoudleService pkMoudleService;
@Autowired
PkDevelopService pkDevelopService;
@Autowired
PkService pkService;
private DuibaLog logger = DuibaLog.getLogger();
private static Integer uid = 5029;//
private static Integer uid = 5029;
private static String betId;
private static String optionId1;
private static String optionId2;
//@Test
@Test
public void 创建PK活动() throws Exception{
Response response = pkDevelopService.betEditor("21771","4",null,"30");
Assert.assertEquals(response.jsonPath().getString("desc"),"成功","创建组件化pk活动失败");
response = pkService.getBetList(uid);
response.print();
int i= 30;
while(i>0&&(response.jsonPath().getString("data.unbetList").equals("[]"))){
Thread.sleep(5000);
response = pkService.getBetList(uid);
response.print();
i--;
}
betId = response.jsonPath().getString("data.unbetList[0].betConfig.id");
optionId1 = response.jsonPath().getString("data.unbetList[0].options[0].optionId");
optionId2 = response.jsonPath().getString("data.unbetList[0].options[1].optionId");
if(betId.equals(null)){
throw new Exception("楼层查询pk组件活动失败!");
}else {
logger.info("pk活动id 为:" + betId + ",投注id1为:" + optionId1 + ",投注id2为:" + optionId2);
}
}
@Test(dependsOnMethods = { "创建PK活动" })
public void 投注() throws Exception {
// Response res1 = pkService.doJoin(user01,newBetId,optionsIds.get(0));
// Response res2 = pkService.doJoin(user02,newBetId,optionsIds.get(1));
}
}
\ No newline at end of file
......@@ -10,27 +10,18 @@ package http.cases.PkMoudleTest;
import base.DuibaLog;
import base.DuibaTestBase;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import http.model.BetMobileVo;
import http.service.Activity.PkMoudleService;
import http.service.Activity.PkService;
import io.restassured.response.Response;
import org.springframework.beans.factory.annotation.Autowired;
import org.testng.Assert;
import org.testng.annotations.Test;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
public class 配置测试_AccessTest extends DuibaTestBase {
@Autowired
PkMoudleService pkMoudleService;
PkService pkService;
private DuibaLog logger = DuibaLog.getLogger();
private static Integer uid = 5028;//
......@@ -39,7 +30,7 @@ public class 配置测试_AccessTest extends DuibaTestBase {
@Test
public void 配置测试() throws Exception{
Response response = pkMoudleService.getBetList(uid);
Response response = pkService.getBetList(uid);
response.print();
//分积分配置获取
......
/**
* Copyright (C), 2015-2018
* FileName: PkService
* Author: qianwenjun
* Date: 2018/8/5 11:37
* Description:
*/
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;
/**
* @author zhaoran
* @create 2018/12/10
* @since 1.0.0
*/
@Service
public class PkMoudleService {
@Autowired
Authorization authorization;
@Value("${activity.host}")
String activityHost;
private DuibaLog logger = DuibaLog.getLogger();
public Response getBetList(Integer uid) throws Exception{
String url = activityHost + "/betActivity2/list";
Map<String,Object> map = new HashMap<>();
map.put("pageNo","1");
map.put("pageSize","6");
Response response = given().cookies(authorization.dafuwengLogin(uid)).params(map).get(url);
// response.prettyPrint();
try{
Assert.assertEquals(response.jsonPath().getString("success"),"true");
}catch(Exception e){
throw new Exception("手机端获取pk列表接口失败,返回信息:"+response.asString());
}catch(Error er){
throw new Exception("手机端获取pk列表接口失败,返回信息:"+response.asString());
}
return response;
}
}
\ No newline at end of file
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