|
@@ -1,6 +1,6 @@
|
|
package cn.iocoder.yudao.userserver.modules.system.controller;
|
|
package cn.iocoder.yudao.userserver.modules.system.controller;
|
|
|
|
|
|
-import cn.iocoder.yudao.coreservice.modules.system.service.social.SysSocialService;
|
|
|
|
|
|
+import cn.iocoder.yudao.coreservice.modules.system.service.social.SysSocialCoreService;
|
|
import cn.iocoder.yudao.userserver.modules.system.controller.auth.SysAuthController;
|
|
import cn.iocoder.yudao.userserver.modules.system.controller.auth.SysAuthController;
|
|
import cn.iocoder.yudao.userserver.modules.system.service.auth.SysAuthService;
|
|
import cn.iocoder.yudao.userserver.modules.system.service.auth.SysAuthService;
|
|
import cn.iocoder.yudao.userserver.modules.system.service.sms.SysSmsCodeService;
|
|
import cn.iocoder.yudao.userserver.modules.system.service.sms.SysSmsCodeService;
|
|
@@ -14,9 +14,7 @@ import org.springframework.test.web.servlet.MockMvc;
|
|
import org.springframework.test.web.servlet.result.MockMvcResultHandlers;
|
|
import org.springframework.test.web.servlet.result.MockMvcResultHandlers;
|
|
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
|
|
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
|
|
|
|
|
|
-import static org.springframework.http.HttpHeaders.AUTHORIZATION;
|
|
|
|
-import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
|
|
|
|
-import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
|
|
|
|
|
|
+import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
|
|
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
|
|
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -36,8 +34,7 @@ public class SysAuthControllerTest {
|
|
@Mock
|
|
@Mock
|
|
private SysSmsCodeService smsCodeService;
|
|
private SysSmsCodeService smsCodeService;
|
|
@Mock
|
|
@Mock
|
|
- private SysSocialService socialService;
|
|
|
|
-
|
|
|
|
|
|
+ private SysSocialCoreService socialService;
|
|
|
|
|
|
@Before
|
|
@Before
|
|
public void setup() {
|
|
public void setup() {
|
|
@@ -50,26 +47,22 @@ public class SysAuthControllerTest {
|
|
|
|
|
|
@Test
|
|
@Test
|
|
public void testResetPassword_success() throws Exception {
|
|
public void testResetPassword_success() throws Exception {
|
|
- //模拟接口调用
|
|
|
|
|
|
+ // 模拟接口调用
|
|
this.mockMvc.perform(post("/reset-password")
|
|
this.mockMvc.perform(post("/reset-password")
|
|
.contentType(MediaType.APPLICATION_JSON)
|
|
.contentType(MediaType.APPLICATION_JSON)
|
|
.content("{\"password\":\"1123\",\"code\":\"123456\"}}"))
|
|
.content("{\"password\":\"1123\",\"code\":\"123456\"}}"))
|
|
.andExpect(status().isOk())
|
|
.andExpect(status().isOk())
|
|
.andDo(MockMvcResultHandlers.print());
|
|
.andDo(MockMvcResultHandlers.print());
|
|
-
|
|
|
|
}
|
|
}
|
|
|
|
|
|
@Test
|
|
@Test
|
|
public void testUpdatePassword_success() throws Exception {
|
|
public void testUpdatePassword_success() throws Exception {
|
|
- //模拟接口调用
|
|
|
|
|
|
+ // 模拟接口调用
|
|
this.mockMvc.perform(post("/update-password")
|
|
this.mockMvc.perform(post("/update-password")
|
|
.contentType(MediaType.APPLICATION_JSON)
|
|
.contentType(MediaType.APPLICATION_JSON)
|
|
.content("{\"password\":\"1123\",\"code\":\"123456\",\"oldPassword\":\"1123\"}}"))
|
|
.content("{\"password\":\"1123\",\"code\":\"123456\",\"oldPassword\":\"1123\"}}"))
|
|
.andExpect(status().isOk())
|
|
.andExpect(status().isOk())
|
|
.andDo(MockMvcResultHandlers.print());
|
|
.andDo(MockMvcResultHandlers.print());
|
|
-
|
|
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
}
|
|
}
|