Authored by fangyeqing

ADD:add test for dataShare

@@ -7,7 +7,7 @@ public interface Constants { @@ -7,7 +7,7 @@ public interface Constants {
7 /** 7 /**
8 * 服务地址 8 * 服务地址
9 */ 9 */
10 -// String URL_PREFIX = "http://127.0.0.1:8090"; 10 + //String URL_PREFIX = "http://127.0.0.1:8090";
11 String URL_PREFIX = "https://www.hanhezy.com:8090/"; 11 String URL_PREFIX = "https://www.hanhezy.com:8090/";
12 // String URL_PREFIX = "http://139.129.166.85:8090"; 12 // String URL_PREFIX = "http://139.129.166.85:8090";
13 /** 13 /**
@@ -53,6 +53,7 @@ public interface Constants { @@ -53,6 +53,7 @@ public interface Constants {
53 int USER_MODPASS_LOGOUT = 1002;//修改密码成功,请重新登录 53 int USER_MODPASS_LOGOUT = 1002;//修改密码成功,请重新登录
54 int REPORT_INVALID_ERROR = -11142;//报告在数据库中不存在/Report is not exist in the DB 54 int REPORT_INVALID_ERROR = -11142;//报告在数据库中不存在/Report is not exist in the DB
55 int USER_NOT_FOUND = -1002;//用户不存在/User is not exist 55 int USER_NOT_FOUND = -1002;//用户不存在/User is not exist
  56 + int COMPANY_ERROR =-11170;//"用户所属公司信息有误/Company infomation error";
56 57
57 58
58 } 59 }
  1 +package com.xkl;
  2 +
  3 +import org.junit.Assert;
  4 +import org.junit.Test;
  5 +
  6 +import java.util.HashMap;
  7 +import java.util.Map;
  8 +
  9 +/**
  10 + * Created by win7 on 2017/3/19.
  11 + */
  12 +public class DataShareTest {
  13 + private static final String DataShare_REPORT_LIST = Constants.URL_PREFIX + "/dataShare/list";
  14 + private static final String DataShare_REPORT_DETAIL = Constants.URL_PREFIX + "/dataShare/detail";
  15 +
  16 + /**
  17 + * 数据共享-体检报告列表查询接口
  18 + */
  19 + @Test
  20 + public void testDataShareList() {
  21 + Map<String, String> params = new HashMap<String, String>();
  22 + params.put("t", HttpTools.getNow());
  23 + params.put("type", Constants.KEY_ID);
  24 + params.put("sign", HttpTools.getSign(params));
  25 + String response = HttpTools.requestByMap(DataShare_REPORT_LIST, "GET", params);
  26 + Assert.assertTrue(RtnCodeTools.verifyCode(response, Constants.CODE_SUCC));
  27 + System.out.println(response);
  28 + }
  29 +
  30 + /**
  31 + * 数据共享-体检报告详情查询接口
  32 + */
  33 + @Test
  34 + public void testDataShareDetail() {
  35 + Map<String, String> params = new HashMap<String, String>();
  36 + params.put("report_id", "77");
  37 + params.put("t", HttpTools.getNow());
  38 + params.put("type", Constants.KEY_ID);
  39 + params.put("sign", HttpTools.getSign(params));
  40 + String response = HttpTools.requestByMap(DataShare_REPORT_DETAIL, "GET", params);
  41 + Assert.assertTrue(RtnCodeTools.verifyCode(response, Constants.CODE_SUCC));
  42 + System.out.println(response);
  43 + }
  44 +
  45 + /**
  46 + * 数据共享-体检报告详情查询接口(报告所属的公司信息有误)
  47 + */
  48 + @Test
  49 + public void testDataShareDetail_WrongCompany() {
  50 + Map<String, String> params = new HashMap<String, String>();
  51 + params.put("report_id", "119");
  52 + params.put("t", HttpTools.getNow());
  53 + params.put("type", Constants.KEY_ID);
  54 + params.put("sign", HttpTools.getSign(params));
  55 + String response = HttpTools.requestByMap(DataShare_REPORT_DETAIL, "GET", params);
  56 + Assert.assertTrue(RtnCodeTools.verifyCode(response, Constants.COMPANY_ERROR));
  57 + System.out.println(response);
  58 + }
  59 +}