From addf0f46235999905a3df2e716a4cf31ae7f3151 Mon Sep 17 00:00:00 2001 From: "shengzhaoli.shengz" Date: Tue, 31 Oct 2023 20:01:14 +0800 Subject: [PATCH] /oauth2/rest_token API doc --- .../sos/web/controller/OAuthRestControllerTest.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/test/java/com/monkeyk/sos/web/controller/OAuthRestControllerTest.java b/src/test/java/com/monkeyk/sos/web/controller/OAuthRestControllerTest.java index 5bae263..1277f70 100644 --- a/src/test/java/com/monkeyk/sos/web/controller/OAuthRestControllerTest.java +++ b/src/test/java/com/monkeyk/sos/web/controller/OAuthRestControllerTest.java @@ -15,6 +15,7 @@ import org.springframework.restdocs.RestDocumentationExtension; import org.springframework.security.crypto.password.PasswordEncoder; import org.springframework.security.oauth2.server.authorization.OAuth2AuthorizationConsentService; import org.springframework.security.oauth2.server.authorization.client.RegisteredClientRepository; +import org.springframework.security.oauth2.server.authorization.settings.AuthorizationServerSettings; import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.request.MockHttpServletRequestBuilder; @@ -28,6 +29,7 @@ import static org.junit.jupiter.api.Assertions.*; import static org.springframework.restdocs.mockmvc.MockMvcRestDocumentation.document; import static org.springframework.restdocs.mockmvc.MockMvcRestDocumentation.documentationConfiguration; 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.*; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath; @@ -67,6 +69,9 @@ class OAuthRestControllerTest { @MockBean private PasswordEncoder passwordEncoder; + @MockBean + private AuthorizationServerSettings authorizationServerSettings; + @BeforeEach public void setup(WebApplicationContext applicationContext, RestDocumentationContextProvider contextProvider) { @@ -96,9 +101,9 @@ class OAuthRestControllerTest { .content(content); mockMvc.perform(requestBuilder) + //.andDo(print()) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON)) -// .andDo(print()) .andExpect(jsonPath("access_token").exists()) // .andExpect(jsonPath("username").value(username)) .andExpect(jsonPath("refresh_token").exists())