Commit 59de9f7e authored by panyuli's avatar panyuli

权益一期测试点

parent 8bc22e79
package http.service.Activity;
import http.service.Authorization;
import io.restassured.http.Cookies;
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;
@Service
public class equityPrizeService {
@Value("${activity.host}")
String activityHost;
@Autowired
Authorization authorization;
/**
* 核销一期 /aaw/equityPrize/exchange
* Request Method: POST
*
* @param excCode 兑换码
* @return
* @throws Exception
*/
public Response exchange(Map cookies, String excCode, String validate) throws Exception {
Map<String, String> map = new HashMap<>();
map.put("excCode", excCode);
map.put("validate", validate);
Response response = given().cookies(cookies).params(map).post(activityHost + "/aaw/equityPrize/exchange");
try {
// Assert.assertEquals(response.jsonPath().getString("success"), "true", "/aaw/equityPrize/exchange接口失败");
Assert.assertEquals(String.valueOf(response.getStatusCode()), "200", "/aaw/equityPrize/exchange接口失败");
} catch (Exception e) {
throw new Exception("/aaw/equityPrize/exchange接口失败,返回信息:" + response.asString());
} catch (Error er) {
throw new Exception("/aaw/equityPrize/exchange接口失败,返回信息:" + 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