updated tests to reflect that registering with an existing email address no longer throws an unprocessable exception

This commit is contained in:
nwoodward
2023-05-02 15:55:18 -05:00
parent 80af0665c1
commit 9cca5ee12a

View File

@@ -226,7 +226,7 @@ public class RegistrationRestRepositoryIT extends AbstractControllerIntegrationT
}
@Test
public void testRegisterDomainNotRegisteredMailAddressRegistred() throws Exception {
public void testRegisterMailAddressRegistered() throws Exception {
List<RegistrationData> registrationDataList = registrationDataDAO.findAll(context, RegistrationData.class);
try {
context.turnOffAuthorisationSystem();
@@ -236,7 +236,7 @@ public class RegistrationRestRepositoryIT extends AbstractControllerIntegrationT
.withCanLogin(true)
.build();
context.restoreAuthSystemState();
configurationService.setProperty("authentication-password.domain.valid", "test.com");
RegistrationRest registrationRest = new RegistrationRest();
registrationRest.setEmail(email);
@@ -245,9 +245,10 @@ public class RegistrationRestRepositoryIT extends AbstractControllerIntegrationT
.param(TYPE_QUERY_PARAM, TYPE_REGISTER)
.content(mapper.writeValueAsBytes(registrationRest))
.contentType(contentType))
.andExpect(status().isUnprocessableEntity());
.andExpect(status().isCreated());
registrationDataList = registrationDataDAO.findAll(context, RegistrationData.class);
assertEquals(0, registrationDataList.size());
assertEquals(1, registrationDataList.size());
assertTrue(StringUtils.equalsIgnoreCase(registrationDataList.get(0).getEmail(), email));
} finally {
Iterator<RegistrationData> iterator = registrationDataList.iterator();
while (iterator.hasNext()) {