Authored by zhaoyue

add test case of pulse and log

@@ -3,7 +3,7 @@ git add --all src/* @@ -3,7 +3,7 @@ git add --all src/*
3 git add --all lib/* 3 git add --all lib/*
4 git add push.sh 4 git add push.sh
5 git add pom.xml 5 git add pom.xml
6 -git commit -m "Mod file location " 6 +git commit -m "add test case of pulse and log "
7 git push origin master 7 git push origin master
8 git status 8 git status
9 git pull 9 git pull
  1 +package com.xkl.internal;
  2 +
  3 +import com.xkl.Constants;
  4 +import com.xkl.HttpTools;
  5 +import com.xkl.RtnCodeTools;
  6 +import com.xkl.partner.TokenTest;
  7 +import org.junit.Assert;
  8 +import org.junit.Test;
  9 +
  10 +import java.util.HashMap;
  11 +import java.util.Map;
  12 +
  13 +/**
  14 + * Created by zhaoyue on 2017/3/11.
  15 + */
  16 +public class AdminSetPulseBreathRateTest {
  17 + private static final String URL_ADMIN_OP_LOG = Constants.URL_PREFIX + "/setPulseBreath";
  18 +
  19 + @Test
  20 + public void adminSetPulseBreathRateTest() {
  21 + String token = TokenTest.adminLoginAndGetToken(Constants.ADMIN_ACCOUNT, Constants.ADMIN_PWD);
  22 +
  23 + Map<String, String> params = new HashMap<String, String>();
  24 + params.put("username", Constants.USR_ACC);
  25 + params.put("pulse", "80");
  26 + params.put("breathrate", "19");
  27 + params.put("type", Constants.KEY_ID);
  28 + params.put("t", HttpTools.getNow());
  29 + params.put("sign", HttpTools.getSign(params));
  30 + String response = HttpTools.requestByMapWithToken(URL_ADMIN_OP_LOG, "POST", params, token);
  31 + System.out.println(response);
  32 + Assert.assertTrue(RtnCodeTools.verifyCode(response, Constants.CODE_SUCC));
  33 + }
  34 +}
@@ -26,7 +26,7 @@ public class UserInfoTest { @@ -26,7 +26,7 @@ public class UserInfoTest {
26 public void testRegister() { 26 public void testRegister() {
27 String adminUser = Constants.ADMIN_ACCOUNT; 27 String adminUser = Constants.ADMIN_ACCOUNT;
28 String adminPass = Constants.ADMIN_PWD; 28 String adminPass = Constants.ADMIN_PWD;
29 - String user = "15211112222"; 29 + String user = "1521111212";
30 String pass = "pass152"; 30 String pass = "pass152";
31 String name = "usernameTest"; 31 String name = "usernameTest";
32 String sex = Constants.MALE; 32 String sex = Constants.MALE;
@@ -24,6 +24,8 @@ public class AccountTest { @@ -24,6 +24,8 @@ public class AccountTest {
24 Map<String, String> params = new HashMap<String, String>(); 24 Map<String, String> params = new HashMap<String, String>();
25 params.put("account", user); 25 params.put("account", user);
26 params.put("password", EncodeTools.encode("MD5", pass)); 26 params.put("password", EncodeTools.encode("MD5", pass));
  27 + System.out.println(EncodeTools.encode("MD5", pass));
  28 +
27 params.put("t", HttpTools.getNow()); 29 params.put("t", HttpTools.getNow());
28 String response = HttpTools.requestByMap(URL_LOGIN, "POST", params); 30 String response = HttpTools.requestByMap(URL_LOGIN, "POST", params);
29 System.out.println("login success:" + response); 31 System.out.println("login success:" + response);