KEYCLOAK-2565 - Add assert check to testsuite for KEYCLOAK-2554 and KEYCLOAK-2555
This commit is contained in:
parent
4286f0560f
commit
cfc61fa262
3 changed files with 14 additions and 1 deletions
|
@ -30,6 +30,8 @@ import java.net.URI;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import javax.ws.rs.core.Response.Status;
|
||||||
|
import javax.ws.rs.core.Response.StatusType;
|
||||||
import org.apache.commons.lang.builder.EqualsBuilder;
|
import org.apache.commons.lang.builder.EqualsBuilder;
|
||||||
|
|
||||||
import static org.keycloak.representations.idm.CredentialRepresentation.PASSWORD;
|
import static org.keycloak.representations.idm.CredentialRepresentation.PASSWORD;
|
||||||
|
@ -44,6 +46,11 @@ public class ApiUtil {
|
||||||
|
|
||||||
public static String getCreatedId(Response response) {
|
public static String getCreatedId(Response response) {
|
||||||
URI location = response.getLocation();
|
URI location = response.getLocation();
|
||||||
|
if (!response.getStatusInfo().equals(Status.CREATED)) {
|
||||||
|
StatusType statusInfo = response.getStatusInfo();
|
||||||
|
throw new RuntimeException("Create method returned status " +
|
||||||
|
statusInfo.getReasonPhrase() + " (Code: " + statusInfo.getStatusCode() + "); expected status: Created (201)");
|
||||||
|
}
|
||||||
if (location == null) {
|
if (location == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,10 +17,13 @@
|
||||||
package org.keycloak.testsuite.account;
|
package org.keycloak.testsuite.account;
|
||||||
|
|
||||||
import org.jboss.arquillian.graphene.page.Page;
|
import org.jboss.arquillian.graphene.page.Page;
|
||||||
|
import static org.junit.Assert.assertEquals;
|
||||||
|
import static org.junit.Assert.assertNotNull;
|
||||||
|
import static org.junit.Assert.assertNull;
|
||||||
|
import static org.junit.Assert.assertTrue;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.keycloak.testsuite.auth.page.login.Registration;
|
import org.keycloak.testsuite.auth.page.login.Registration;
|
||||||
|
|
||||||
import static org.junit.Assert.*;
|
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import static org.keycloak.representations.idm.CredentialRepresentation.PASSWORD;
|
import static org.keycloak.representations.idm.CredentialRepresentation.PASSWORD;
|
||||||
import org.keycloak.representations.idm.RealmRepresentation;
|
import org.keycloak.representations.idm.RealmRepresentation;
|
||||||
|
@ -58,6 +61,7 @@ public class RegistrationTest extends AbstractAccountManagementTest {
|
||||||
setPasswordFor(newUser, PASSWORD);
|
setPasswordFor(newUser, PASSWORD);
|
||||||
|
|
||||||
testRealmAccountManagementPage.navigateTo();
|
testRealmAccountManagementPage.navigateTo();
|
||||||
|
assertTrue("Registration should be allowed.", testRealmResource().toRepresentation().isRegistrationAllowed());
|
||||||
testRealmLoginPage.form().register();
|
testRealmLoginPage.form().register();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,7 @@ package org.keycloak.testsuite.account;
|
||||||
import org.jboss.arquillian.graphene.page.Page;
|
import org.jboss.arquillian.graphene.page.Page;
|
||||||
import org.junit.AfterClass;
|
import org.junit.AfterClass;
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
|
import static org.junit.Assert.assertTrue;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.keycloak.representations.idm.RealmRepresentation;
|
import org.keycloak.representations.idm.RealmRepresentation;
|
||||||
|
@ -61,6 +62,7 @@ public class ResetCredentialsTest extends AbstractAccountManagementTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
testRealmAccountManagementPage.navigateTo();
|
testRealmAccountManagementPage.navigateTo();
|
||||||
|
assertTrue("Reset password should be allowed.", testRealmResource().toRepresentation().isResetPasswordAllowed());
|
||||||
testRealmLoginPage.form().forgotPassword();
|
testRealmLoginPage.form().forgotPassword();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue