22 changed files with 534 additions and 29 deletions
@ -0,0 +1,67 @@ |
|||
|
|||
### |
|||
### login |
|||
# @name login |
|||
# POST http://localhost:7290/users/signin |
|||
POST http://101.201.226.163/gateway/ptostall/users/signin |
|||
{{type}} |
|||
Authorization: Bearer {{login.response.body.$.data.token}} |
|||
deviceId: 66666 |
|||
|
|||
{ |
|||
"client": 0, |
|||
"type": 3, |
|||
"data": { |
|||
"identifier": "zy", |
|||
"credential": "123456" |
|||
|
|||
} |
|||
} |
|||
|
|||
<> 2022-04-27T141611.200.json |
|||
<> 2022-04-27T141601.200.json |
|||
|
|||
### |
|||
|
|||
GET http://localhost:7320/v1.0/debug |
|||
Accept: application/json;charset=UTF-8 |
|||
|
|||
### |
|||
|
|||
POST http://localhost:7320/v1.0/deliver/queryChecker |
|||
Accept: application/json;charset=UTF-8 |
|||
Cache-Control: no-cache |
|||
Content-Type: application/json |
|||
|
|||
{ |
|||
"param": { |
|||
"projectId": 1 |
|||
} |
|||
} |
|||
|
|||
### |
|||
|
|||
POST http://localhost:7320/v1.0/deliver/saveDeliver |
|||
Accept: application/json;charset=UTF-8 |
|||
Cache-Control: no-cache |
|||
Content-Type: application/json |
|||
|
|||
{ |
|||
"param": { |
|||
"projectId": 1, |
|||
"taskId": 1, |
|||
"deliverName": "测试i交付物" |
|||
} |
|||
} |
|||
|
|||
### 查看交付物提交记录 |
|||
POST http://localhost:7320/v1.0/deliver/queryCheckLog |
|||
{{type}} |
|||
Authorization: Bearer {{login.response.body.$.data.token}} |
|||
|
|||
{ |
|||
"param":{ |
|||
"deliverRecordId": "1506479764368793600" |
|||
} |
|||
} |
|||
|
@ -0,0 +1,5 @@ |
|||
{ |
|||
"dev": { |
|||
"name": "value" |
|||
} |
|||
} |
@ -0,0 +1,59 @@ |
|||
package com.ccsens.ptccsens.api; |
|||
|
|||
import com.ccsens.ptccsens.PtCcsensApplication; |
|||
import com.itextpdf.text.log.SysoLogger; |
|||
import org.hamcrest.core.Is; |
|||
import org.junit.Before; |
|||
import org.junit.Test; |
|||
import org.junit.runner.RunWith; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; |
|||
import org.springframework.boot.test.context.SpringBootTest; |
|||
import org.springframework.http.MediaType; |
|||
import org.springframework.test.context.junit4.SpringRunner; |
|||
import org.springframework.test.web.servlet.MockMvc; |
|||
import org.springframework.test.web.servlet.MvcResult; |
|||
import org.springframework.test.web.servlet.ResultMatcher; |
|||
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; |
|||
import org.springframework.test.web.servlet.result.MockMvcResultHandlers; |
|||
import org.springframework.test.web.servlet.result.MockMvcResultMatchers; |
|||
import org.springframework.test.web.servlet.setup.MockMvcBuilders; |
|||
import org.springframework.web.context.WebApplicationContext; |
|||
|
|||
import static org.junit.Assert.*; |
|||
|
|||
/** |
|||
* @author :mr.zhangsan |
|||
* @date :2022/4/26 17:01 |
|||
* @version: v1.0 |
|||
*/ |
|||
|
|||
@RunWith(SpringRunner.class) |
|||
@SpringBootTest(classes = PtCcsensApplication.class) |
|||
public class DebugControllerTest { |
|||
@Autowired |
|||
private WebApplicationContext context; |
|||
|
|||
private MockMvc mockMvc; |
|||
|
|||
@Before |
|||
public void before() throws Exception { |
|||
mockMvc = MockMvcBuilders.webAppContextSetup(context).build(); |
|||
} |
|||
|
|||
@Test |
|||
public void debug() throws Exception { |
|||
MvcResult mvcResult = mockMvc.perform( |
|||
MockMvcRequestBuilders.get("/debug") |
|||
.param("name", "felord.cn") |
|||
.param("age", "18") |
|||
.header("Api-Version", "v1") |
|||
).andExpect(ResultMatcher.matchAll( |
|||
MockMvcResultMatchers.status().isOk(), |
|||
MockMvcResultMatchers.content().contentType(MediaType.APPLICATION_JSON_UTF8), |
|||
MockMvcResultMatchers.jsonPath("$.code", Is.is(200)) |
|||
) |
|||
).andDo(MockMvcResultHandlers.print()).andReturn(); |
|||
System.out.println("Test Result: " + mvcResult.getResponse().getContentAsString()); |
|||
} |
|||
} |
@ -0,0 +1,80 @@ |
|||
package com.ccsens.ptccsens.api; |
|||
|
|||
import com.ccsens.ptccsens.PtCcsensApplication; |
|||
import org.hamcrest.core.Is; |
|||
import org.junit.Before; |
|||
import org.junit.Test; |
|||
import org.junit.runner.RunWith; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.boot.test.context.SpringBootTest; |
|||
import org.springframework.http.MediaType; |
|||
import org.springframework.test.context.junit4.SpringRunner; |
|||
import org.springframework.test.web.servlet.MockMvc; |
|||
import org.springframework.test.web.servlet.MvcResult; |
|||
import org.springframework.test.web.servlet.ResultMatcher; |
|||
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; |
|||
import org.springframework.test.web.servlet.result.MockMvcResultHandlers; |
|||
import org.springframework.test.web.servlet.result.MockMvcResultMatchers; |
|||
import org.springframework.test.web.servlet.setup.MockMvcBuilders; |
|||
import org.springframework.web.context.WebApplicationContext; |
|||
|
|||
/** |
|||
* @author :mr.zhangsan |
|||
* @date :2022/4/26 18:40 |
|||
* @version: v1.0 |
|||
*/ |
|||
|
|||
@RunWith(SpringRunner.class) |
|||
@SpringBootTest(classes = PtCcsensApplication.class) |
|||
public class DeliverControllerTest { |
|||
|
|||
@Autowired |
|||
private WebApplicationContext context; |
|||
|
|||
private MockMvc mockMvc; |
|||
|
|||
@Before |
|||
public void before() throws Exception { |
|||
mockMvc = MockMvcBuilders.webAppContextSetup(context).build(); |
|||
} |
|||
|
|||
@Test |
|||
public void queryChecker() throws Exception { |
|||
MvcResult mvcResult = mockMvc.perform( |
|||
MockMvcRequestBuilders.get("/deliver/queryChecker") |
|||
.param("name", "felord.cn") |
|||
.param("age", "18") |
|||
.header("Api-Version", "v1") |
|||
).andExpect(ResultMatcher.matchAll( |
|||
MockMvcResultMatchers.status().isOk(), |
|||
MockMvcResultMatchers.content().contentType(MediaType.APPLICATION_JSON_UTF8), |
|||
MockMvcResultMatchers.jsonPath("$.code", Is.is(200)) |
|||
) |
|||
).andDo(MockMvcResultHandlers.print()).andReturn(); |
|||
System.out.println("Test Result: " + mvcResult.getResponse().getContentAsString()); |
|||
} |
|||
|
|||
@Test |
|||
public void saveDeliver() { |
|||
} |
|||
|
|||
@Test |
|||
public void getDeliver() { |
|||
} |
|||
|
|||
@Test |
|||
public void submitDeliver() { |
|||
} |
|||
|
|||
@Test |
|||
public void checkDeliver() { |
|||
} |
|||
|
|||
@Test |
|||
public void queryRecord() { |
|||
} |
|||
|
|||
@Test |
|||
public void queryCheckLog() { |
|||
} |
|||
} |
Loading…
Reference in new issue