We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weโll occasionally send you account related emails.
Already on GitHub? Sign in to your account
@Test @DisplayName("select ํ๋ฉด์ ๋ก๊ทธ์ธ ํ์ง ์์ ์ํ๋ก ์ ๊ทผ๊ฐ๋ฅํด์ ์๋๋ค.") public void loginSelectTest1() throws Exception { mockMvc.perform(get("http://localhost:8080/login/select")) .andExpect(status().is3xxRedirection()) .andDo(print()); }
์ธ์ฆ์ด ๋์ง ์์ ๊ฒฝ์ฐ 403์ ๋ฐํํ์ง ์๊ณ ๋ก๊ทธ์ธ ํ์ด์ง๋ก ๋์ด๊ฐ๊ธฐ ๋๋ฌธ์ 302(Redirction code)๊ฐ ๋ฐํ๋ฉ๋๋ค.
@Test @WithMockUser @DisplayName("select ํ๋ฉด์ ์ธ์ฆ๋ ์ ์ ๊ฐ ์ ๊ทผํ ์ ์์ด์ผ ํ๋ค.") public void loginSelectTest2() throws Exception { mockMvc.perform(get("http://localhost:8080/login/select") .accept(MediaType.parseMediaType("application/html;charset=UTF-8"))) .andExpect(view().name("login_signup_select")) ; }
The text was updated successfully, but these errors were encountered:
TemplateInputException ์ผ๋ก template์ resolve ํ ์ ์๋ค๋ ์๋ฌ๊ฐ ๋ฐ์ํฉ๋๋ค. ๊ฐ์ฅ ์ ๋ ฅํ ๊ฐ์ค์ ํ ์คํธ ํ๊ฒฝ์์ ์ฌ์ฉ๋๋ MockMvc๊ฐ mock์ด๊ธฐ ๋๋ฌธ์ ์คํ๋ง ๋ถํธ๊ฐ ๋ชจ๋ ์๋ธ๋ฆฟ ์ปจํ ์ด๋๋ฅผ ์ ๊ณตํ์ง ์์ view๋ฅผ rendering ํ ์ ์๋ค๋ ๋ด์ฉ์ ๋๋ค. https://stackoverflow.com/questions/66641634/spring-controller-modelandview-test-mockmvc-empty-response
Sorry, something went wrong.
david-parkk
No branches or pull requests
๐ Spring security ํ๊ฒฝ์์ Test ํ๊ธฐ
๋ชฉํ
ํ ์คํ ํ๊ฒฝ
Test 1 ํ์ฉ๋์ง ์์ URL ์ ์์ 403 โญ
์ธ์ฆ์ด ๋์ง ์์ ๊ฒฝ์ฐ 403์ ๋ฐํํ์ง ์๊ณ ๋ก๊ทธ์ธ ํ์ด์ง๋ก ๋์ด๊ฐ๊ธฐ ๋๋ฌธ์ 302(Redirction code)๊ฐ ๋ฐํ๋ฉ๋๋ค.
Test 2 ์ธ์ฆ๋ User๋ URL ์ ์์ 200 (๋๋ View ๋ฐํ) โ
Test 3 ์ธ์ฆ๋ User๊ฐ ๋ค์ ํ์๊ฐ์ ํ๋ ค๋ ๊ฒฝ์ฐ ์์ธ๊ฐ ๋ฐ์ํ๋์ง (๊ตฌํ ์ํจ)
The text was updated successfully, but these errors were encountered: