Skip to content

Commit

Permalink
Add test for password limit
Browse files Browse the repository at this point in the history
  • Loading branch information
VasilyevPS committed Sep 26, 2023
1 parent ed23f34 commit 608d8be
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/test/java/io/hexlet/typoreporter/web/SignupControllerIT.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
import static org.assertj.core.api.Assertions.assertThat;
import static io.hexlet.typoreporter.test.Constraints.POSTGRES_IMAGE;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;

@SpringBootTest
@AutoConfigureMockMvc
Expand Down Expand Up @@ -107,4 +108,22 @@ void createAccountWithWrongEmailDomain() throws Exception {
.with(csrf()));
assertThat(accountRepository.findAccountByEmail(wrongEmailDomain)).isEmpty();
}

void createAccountWithWrongPassword() throws Exception {
String userName = "testUser";
String wrongPass = "pass";
String email = "[email protected]";
mockMvc.perform(post("/signup")
.param("username", userName)
.param("email", email)
.param("confirmEmail", email)
.param("password", wrongPass)
.param("confirmPassword", wrongPass)
.param("firstName", userName)
.param("lastName", userName)
.with(csrf())).andExpect((status().isFound()));
assertThat(accountRepository.findAccountByEmail(email)).isEmpty();

}

}

0 comments on commit 608d8be

Please sign in to comment.