Merge pull request #3810 from vramik/KEYCLOAK-4337
KEYCLOAK-4337 Few fixes for testsuite
This commit is contained in:
commit
beb96b7f01
4 changed files with 15 additions and 9 deletions
|
@ -155,7 +155,7 @@ public class ExportImportTest extends AbstractKeycloakTest {
|
||||||
|
|
||||||
removeRealm("test");
|
removeRealm("test");
|
||||||
removeRealm("test-realm");
|
removeRealm("test-realm");
|
||||||
assertEquals(1, adminClient.realms().findAll().size());
|
Assert.assertNames(adminClient.realms().findAll(), "master");
|
||||||
|
|
||||||
assertNotAuthenticated("test", "test-user@localhost", "password");
|
assertNotAuthenticated("test", "test-user@localhost", "password");
|
||||||
assertNotAuthenticated("test", "user1", "password");
|
assertNotAuthenticated("test", "user1", "password");
|
||||||
|
@ -168,7 +168,7 @@ public class ExportImportTest extends AbstractKeycloakTest {
|
||||||
testingClient.testing().exportImport().runImport();
|
testingClient.testing().exportImport().runImport();
|
||||||
|
|
||||||
// Ensure data are imported back
|
// Ensure data are imported back
|
||||||
assertEquals(3, adminClient.realms().findAll().size());
|
Assert.assertNames(adminClient.realms().findAll(), "master", "test", "test-realm");
|
||||||
|
|
||||||
assertAuthenticated("test", "test-user@localhost", "password");
|
assertAuthenticated("test", "test-user@localhost", "password");
|
||||||
assertAuthenticated("test", "user1", "password");
|
assertAuthenticated("test", "user1", "password");
|
||||||
|
@ -191,7 +191,7 @@ public class ExportImportTest extends AbstractKeycloakTest {
|
||||||
// Delete some realm (and some data in admin realm)
|
// Delete some realm (and some data in admin realm)
|
||||||
adminClient.realm("test").remove();
|
adminClient.realm("test").remove();
|
||||||
|
|
||||||
assertEquals(2, adminClient.realms().findAll().size());
|
Assert.assertNames(adminClient.realms().findAll(), "test-realm", "master");
|
||||||
|
|
||||||
assertNotAuthenticated("test", "test-user@localhost", "password");
|
assertNotAuthenticated("test", "test-user@localhost", "password");
|
||||||
assertNotAuthenticated("test", "user1", "password");
|
assertNotAuthenticated("test", "user1", "password");
|
||||||
|
@ -204,7 +204,7 @@ public class ExportImportTest extends AbstractKeycloakTest {
|
||||||
testingClient.testing().exportImport().runImport();
|
testingClient.testing().exportImport().runImport();
|
||||||
|
|
||||||
// Ensure data are imported back, but just for "test" realm
|
// Ensure data are imported back, but just for "test" realm
|
||||||
assertEquals(3, adminClient.realms().findAll().size());
|
Assert.assertNames(adminClient.realms().findAll(), "master", "test", "test-realm");
|
||||||
|
|
||||||
assertAuthenticated("test", "test-user@localhost", "password");
|
assertAuthenticated("test", "test-user@localhost", "password");
|
||||||
assertAuthenticated("test", "user1", "password");
|
assertAuthenticated("test", "user1", "password");
|
||||||
|
|
|
@ -23,6 +23,7 @@ import org.keycloak.admin.client.resource.RealmResource;
|
||||||
import org.keycloak.representations.idm.ClientRepresentation;
|
import org.keycloak.representations.idm.ClientRepresentation;
|
||||||
import org.keycloak.testsuite.pages.AccountUpdateProfilePage;
|
import org.keycloak.testsuite.pages.AccountUpdateProfilePage;
|
||||||
import org.keycloak.testsuite.pages.LoginPage;
|
import org.keycloak.testsuite.pages.LoginPage;
|
||||||
|
import org.keycloak.testsuite.ProfileAssume;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -56,6 +57,8 @@ public class AccountPageTest extends AbstractI18NTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testLocalizedReferrerLinkContent() {
|
public void testLocalizedReferrerLinkContent() {
|
||||||
|
ProfileAssume.assumeCommunity();
|
||||||
|
|
||||||
RealmResource testRealm = testRealm();
|
RealmResource testRealm = testRealm();
|
||||||
List<ClientRepresentation> foundClients = testRealm.clients().findByClientId("var-named-test-app");
|
List<ClientRepresentation> foundClients = testRealm.clients().findByClientId("var-named-test-app");
|
||||||
if (foundClients.isEmpty()) {
|
if (foundClients.isEmpty()) {
|
||||||
|
|
|
@ -71,10 +71,14 @@ public class TestEventsLogger extends RunListener {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createPageSrcFile(Description d) throws IOException {
|
private void createPageSrcFile(Description d) throws IOException {
|
||||||
if (driver != null && driver.getPageSource() != null) {
|
try {
|
||||||
String pageSourceLocation = System.getProperty("page.source.location", "target/failed-tests/page-source/");
|
if (driver != null && driver.getPageSource() != null) {
|
||||||
FileUtils.writeStringToFile(new File(pageSourceLocation + d.getTestClass().getSimpleName() + "/" + d.getMethodName() + ".html"),
|
String pageSourceLocation = System.getProperty("page.source.location", "target/failed-tests/page-source/");
|
||||||
driver.getPageSource());
|
FileUtils.writeStringToFile(new File(pageSourceLocation + d.getTestClass().getSimpleName() + "/" + d.getMethodName() + ".html"),
|
||||||
|
driver.getPageSource());
|
||||||
|
}
|
||||||
|
} catch (IllegalStateException ex) {
|
||||||
|
Logger.getLogger(TestEventsLogger.class).warn(ex.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,7 +43,6 @@ import org.keycloak.models.LDAPConstants;
|
||||||
import org.keycloak.models.RealmModel;
|
import org.keycloak.models.RealmModel;
|
||||||
import org.keycloak.models.RealmProvider;
|
import org.keycloak.models.RealmProvider;
|
||||||
import org.keycloak.models.UserModel;
|
import org.keycloak.models.UserModel;
|
||||||
import org.keycloak.models.mongo.keycloak.adapters.MongoRealmProviderFactory;
|
|
||||||
import org.keycloak.models.utils.UserModelDelegate;
|
import org.keycloak.models.utils.UserModelDelegate;
|
||||||
import org.keycloak.representations.idm.ComponentRepresentation;
|
import org.keycloak.representations.idm.ComponentRepresentation;
|
||||||
import org.keycloak.representations.idm.UserRepresentation;
|
import org.keycloak.representations.idm.UserRepresentation;
|
||||||
|
|
Loading…
Reference in a new issue