REM:
添加p1级别测试用例:获取存在的一个能力节点详细信息
This commit is contained in:
lijinxing 2020-05-09 16:39:41 +08:00
parent 6212c72887
commit a6982bec2e
1 changed files with 28 additions and 3 deletions

View File

@ -2,6 +2,7 @@ package com.dispose.controller;
import com.dispose.Global.InitTestEnvironment; import com.dispose.Global.InitTestEnvironment;
import com.dispose.common.ErrorCode; import com.dispose.common.ErrorCode;
import com.dispose.pojo.vo.information.DisposeNodeListRsp;
import com.dispose.pojo.vo.information.NodeTaskRsp; import com.dispose.pojo.vo.information.NodeTaskRsp;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
@ -17,9 +18,7 @@ import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
import javax.annotation.Resource; import javax.annotation.Resource;
import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print; import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
@ -43,7 +42,7 @@ public class DeviceNodeInfoControllerSmokeTest extends InitTestEnvironment {
private ObjectMapper objectMapper; private ObjectMapper objectMapper;
/** /**
* A 1 login normal login test. * A 1 get all task Normal Test.
* *
* @throws Exception the exception * @throws Exception the exception
*/ */
@ -80,4 +79,30 @@ public class DeviceNodeInfoControllerSmokeTest extends InitTestEnvironment {
//Assert.assertEquals(Long.valueOf(rspInfo.getStatus()), Long.valueOf(ErrorCode.ERR_OK.getCode())); //Assert.assertEquals(Long.valueOf(rspInfo.getStatus()), Long.valueOf(ErrorCode.ERR_OK.getCode()));
} }
/**
* C 1 get Node Details Normal Test.
*
* @throws Exception the exception
*/
@Test
public void c1_getNodeDetailsNormalTest() throws Exception {
String reqData = "{\"ver\":2,\"cryptoType\":0,\"timeStamp\":1587604310504,\"msgContent\":\"{\\\"id\\\":[\\\"476\\\"]}\"}";
String ret = mockMvc.perform(MockMvcRequestBuilders
.post("/information/node_details")
.contentType(MediaType.APPLICATION_JSON)
.header("Authorization", "Bearer " + getLogToken())
.content(reqData))
.andDo(print()).andExpect(status().isOk())
.andExpect(jsonPath("$.code").value(ErrorCode.ERR_OK.getHttpCode()))
.andReturn()
.getResponse()
.getContentAsString();
DisposeNodeListRsp rspInfo = objectMapper.readValue(verifyResp(ret), DisposeNodeListRsp.class) ;
Assert.assertNotNull(rspInfo);
Assert.assertNotEquals(rspInfo.getItems().size(), 0);
}
} }