企微前后台联调。
This commit is contained in:
@@ -49,9 +49,10 @@ public class QweiDepartmentControllerTest {
|
||||
serviceResult.put("inserted", 3);
|
||||
serviceResult.put("updated", 5);
|
||||
serviceResult.put("total", 8);
|
||||
when(qweiDepartmentService.syncFromQiWei()).thenReturn(serviceResult);
|
||||
when(qweiDepartmentService.syncFromQiWei("TENANT_TEST")).thenReturn(serviceResult);
|
||||
|
||||
mockMvc.perform(post("/api/qweiDepartment/sync")
|
||||
.param("tenantId", "TENANT_TEST")
|
||||
.contentType(MediaType.APPLICATION_JSON))
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(jsonPath("$.success").value(true))
|
||||
@@ -59,7 +60,7 @@ public class QweiDepartmentControllerTest {
|
||||
.andExpect(jsonPath("$.updated").value(5))
|
||||
.andExpect(jsonPath("$.total").value(8));
|
||||
|
||||
verify(qweiDepartmentService, times(1)).syncFromQiWei();
|
||||
verify(qweiDepartmentService, times(1)).syncFromQiWei("TENANT_TEST");
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -67,14 +68,15 @@ public class QweiDepartmentControllerTest {
|
||||
Map<String, Object> serviceResult = new HashMap<>();
|
||||
serviceResult.put("success", false);
|
||||
serviceResult.put("message", "同步异常:测试错误");
|
||||
when(qweiDepartmentService.syncFromQiWei()).thenReturn(serviceResult);
|
||||
when(qweiDepartmentService.syncFromQiWei("TENANT_TEST")).thenReturn(serviceResult);
|
||||
|
||||
mockMvc.perform(post("/api/qweiDepartment/sync")
|
||||
.param("tenantId", "TENANT_TEST")
|
||||
.contentType(MediaType.APPLICATION_JSON))
|
||||
.andExpect(status().isBadRequest())
|
||||
.andExpect(jsonPath("$.success").value(false));
|
||||
|
||||
verify(qweiDepartmentService, times(1)).syncFromQiWei();
|
||||
verify(qweiDepartmentService, times(1)).syncFromQiWei("TENANT_TEST");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user