|
|
@@ -0,0 +1,53 @@
|
|
|
+package com.uas.sso.controller;
|
|
|
+
|
|
|
+import com.uas.sso.entity.Token;
|
|
|
+import com.uas.sso.service.TokenService;
|
|
|
+import org.junit.Test;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.mock.web.MockHttpServletResponse;
|
|
|
+import org.springframework.util.LinkedMultiValueMap;
|
|
|
+import org.springframework.util.MultiValueMap;
|
|
|
+
|
|
|
+import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
|
|
|
+import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print;
|
|
|
+import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 个人注册测试
|
|
|
+ *
|
|
|
+ * @author wangmh
|
|
|
+ * @create 2018-10-29 14:02
|
|
|
+ **/
|
|
|
+public class PersonalRegisterTest extends BaseControllerTest {
|
|
|
+
|
|
|
+ private final String PRE_URI = "/sso/personal/register";
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private TokenService tokenService;
|
|
|
+
|
|
|
+ @Test
|
|
|
+ public void register() throws Exception {
|
|
|
+ String code = "123456";
|
|
|
+ Token token = new Token(code);
|
|
|
+ tokenService.save(token);
|
|
|
+
|
|
|
+ MultiValueMap<String, String> params = new LinkedMultiValueMap<>();
|
|
|
+ params.add("mobile", "11029000002");
|
|
|
+ params.add("code", code);
|
|
|
+ params.add("token", token.getId());
|
|
|
+ MockHttpServletResponse response = mvc.perform(post(PRE_URI + "/sms").params(params))
|
|
|
+ .andExpect(status().isOk())
|
|
|
+ .andDo(print())
|
|
|
+ .andReturn().getResponse();
|
|
|
+ System.out.println(response.getContentAsString());
|
|
|
+ }
|
|
|
+
|
|
|
+ @Test
|
|
|
+ public void test() {
|
|
|
+ String code = "123456";
|
|
|
+ Token token = new Token(code);
|
|
|
+ tokenService.save(token);
|
|
|
+ System.out.println(token.getId());
|
|
|
+ }
|
|
|
+
|
|
|
+}
|