|
17 | 17 | import com.digitalsanctuary.spring.user.api.data.Response; |
18 | 18 | import com.digitalsanctuary.spring.user.api.helper.AssertionsHelper; |
19 | 19 | import com.digitalsanctuary.spring.user.api.provider.ApiTestRegistrationArgumentsProvider; |
| 20 | +import com.digitalsanctuary.spring.user.api.provider.ApiTestUpdatePasswordArgumentsProvider; |
20 | 21 | import com.digitalsanctuary.spring.user.api.provider.holder.ApiTestArgumentsHolder; |
| 22 | +import com.digitalsanctuary.spring.user.dto.PasswordDto; |
21 | 23 | import com.digitalsanctuary.spring.user.dto.UserDto; |
22 | 24 | import com.digitalsanctuary.spring.user.jdbc.Jdbc; |
23 | 25 | import com.digitalsanctuary.spring.user.persistence.model.User; |
@@ -75,6 +77,39 @@ public void resetPassword() throws Exception { |
75 | 77 | AssertionsHelper.compareResponses(actual, excepted); |
76 | 78 | } |
77 | 79 |
|
| 80 | + /* Temporarily disabled until OAuth2 dependency issue is resolved |
| 81 | + /** |
| 82 | + * Tests the update password functionality with valid and invalid password combinations. |
| 83 | + * |
| 84 | + * @param argumentsHolder Contains test data for password updates (valid/invalid scenarios) |
| 85 | + * @throws Exception if any error occurs during test execution |
| 86 | + */ |
| 87 | + /* |
| 88 | + @ParameterizedTest |
| 89 | + @ArgumentsSource(ApiTestUpdatePasswordArgumentsProvider.class) |
| 90 | + @Order(3) |
| 91 | + public void updatePassword(ApiTestArgumentsHolder argumentsHolder) throws Exception { |
| 92 | + // Register and login test user first |
| 93 | + login(baseTestUser); |
| 94 | + |
| 95 | + PasswordDto passwordDto = argumentsHolder.getPasswordDto(); |
| 96 | + |
| 97 | + ResultActions action = perform(MockMvcRequestBuilders.post(URL + "/updatePassword") |
| 98 | + .contentType(MediaType.APPLICATION_FORM_URLENCODED) |
| 99 | + .content(buildUrlEncodedFormEntity(passwordDto))); |
| 100 | +
|
| 101 | + if (argumentsHolder.getStatus() == DataStatus.VALID) { |
| 102 | + action.andExpect(status().isOk()); |
| 103 | + } |
| 104 | + if (argumentsHolder.getStatus() == DataStatus.INVALID) { |
| 105 | + action.andExpect(status().isBadRequest()); |
| 106 | + } |
| 107 | +
|
| 108 | + MockHttpServletResponse actual = action.andReturn().getResponse(); |
| 109 | + Response expected = argumentsHolder.getResponse(); |
| 110 | + AssertionsHelper.compareResponses(actual, expected); |
| 111 | + } |
| 112 | + */ |
78 | 113 |
|
79 | 114 |
|
80 | 115 | protected void login(UserDto userDto) { |
|
0 commit comments