Authored by fangyeqing

ADD:add test for dataShare

... ... @@ -7,7 +7,7 @@ public interface Constants {
/**
* 服务地址
*/
// String URL_PREFIX = "http://127.0.0.1:8090";
//String URL_PREFIX = "http://127.0.0.1:8090";
String URL_PREFIX = "https://www.hanhezy.com:8090/";
// String URL_PREFIX = "http://139.129.166.85:8090";
/**
... ... @@ -53,6 +53,7 @@ public interface Constants {
int USER_MODPASS_LOGOUT = 1002;//修改密码成功,请重新登录
int REPORT_INVALID_ERROR = -11142;//报告在数据库中不存在/Report is not exist in the DB
int USER_NOT_FOUND = -1002;//用户不存在/User is not exist
int COMPANY_ERROR =-11170;//"用户所属公司信息有误/Company infomation error";
}
... ...
package com.xkl;
import org.junit.Assert;
import org.junit.Test;
import java.util.HashMap;
import java.util.Map;
/**
* Created by win7 on 2017/3/19.
*/
public class DataShareTest {
private static final String DataShare_REPORT_LIST = Constants.URL_PREFIX + "/dataShare/list";
private static final String DataShare_REPORT_DETAIL = Constants.URL_PREFIX + "/dataShare/detail";
/**
* 数据共享-体检报告列表查询接口
*/
@Test
public void testDataShareList() {
Map<String, String> params = new HashMap<String, String>();
params.put("t", HttpTools.getNow());
params.put("type", Constants.KEY_ID);
params.put("sign", HttpTools.getSign(params));
String response = HttpTools.requestByMap(DataShare_REPORT_LIST, "GET", params);
Assert.assertTrue(RtnCodeTools.verifyCode(response, Constants.CODE_SUCC));
System.out.println(response);
}
/**
* 数据共享-体检报告详情查询接口
*/
@Test
public void testDataShareDetail() {
Map<String, String> params = new HashMap<String, String>();
params.put("report_id", "77");
params.put("t", HttpTools.getNow());
params.put("type", Constants.KEY_ID);
params.put("sign", HttpTools.getSign(params));
String response = HttpTools.requestByMap(DataShare_REPORT_DETAIL, "GET", params);
Assert.assertTrue(RtnCodeTools.verifyCode(response, Constants.CODE_SUCC));
System.out.println(response);
}
/**
* 数据共享-体检报告详情查询接口(报告所属的公司信息有误)
*/
@Test
public void testDataShareDetail_WrongCompany() {
Map<String, String> params = new HashMap<String, String>();
params.put("report_id", "119");
params.put("t", HttpTools.getNow());
params.put("type", Constants.KEY_ID);
params.put("sign", HttpTools.getSign(params));
String response = HttpTools.requestByMap(DataShare_REPORT_DETAIL, "GET", params);
Assert.assertTrue(RtnCodeTools.verifyCode(response, Constants.COMPANY_ERROR));
System.out.println(response);
}
}
... ...