Merge pull request #3810 from vramik/KEYCLOAK-4337

KEYCLOAK-4337 Few fixes for testsuite
This commit is contained in:
Pavel Drozd 2017-02-13 10:38:31 +01:00 committed by GitHub
commit beb96b7f01
4 changed files with 15 additions and 9 deletions

View file

@ -155,7 +155,7 @@ public class ExportImportTest extends AbstractKeycloakTest {
removeRealm("test");
removeRealm("test-realm");
assertEquals(1, adminClient.realms().findAll().size());
Assert.assertNames(adminClient.realms().findAll(), "master");
assertNotAuthenticated("test", "test-user@localhost", "password");
assertNotAuthenticated("test", "user1", "password");
@ -168,7 +168,7 @@ public class ExportImportTest extends AbstractKeycloakTest {
testingClient.testing().exportImport().runImport();
// 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", "user1", "password");
@ -191,7 +191,7 @@ public class ExportImportTest extends AbstractKeycloakTest {
// Delete some realm (and some data in admin realm)
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", "user1", "password");
@ -204,7 +204,7 @@ public class ExportImportTest extends AbstractKeycloakTest {
testingClient.testing().exportImport().runImport();
// 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", "user1", "password");

View file

@ -23,6 +23,7 @@ import org.keycloak.admin.client.resource.RealmResource;
import org.keycloak.representations.idm.ClientRepresentation;
import org.keycloak.testsuite.pages.AccountUpdateProfilePage;
import org.keycloak.testsuite.pages.LoginPage;
import org.keycloak.testsuite.ProfileAssume;
import java.util.List;
@ -56,6 +57,8 @@ public class AccountPageTest extends AbstractI18NTest {
@Test
public void testLocalizedReferrerLinkContent() {
ProfileAssume.assumeCommunity();
RealmResource testRealm = testRealm();
List<ClientRepresentation> foundClients = testRealm.clients().findByClientId("var-named-test-app");
if (foundClients.isEmpty()) {

View file

@ -71,10 +71,14 @@ public class TestEventsLogger extends RunListener {
}
private void createPageSrcFile(Description d) throws IOException {
if (driver != null && driver.getPageSource() != null) {
String pageSourceLocation = System.getProperty("page.source.location", "target/failed-tests/page-source/");
FileUtils.writeStringToFile(new File(pageSourceLocation + d.getTestClass().getSimpleName() + "/" + d.getMethodName() + ".html"),
driver.getPageSource());
try {
if (driver != null && driver.getPageSource() != null) {
String pageSourceLocation = System.getProperty("page.source.location", "target/failed-tests/page-source/");
FileUtils.writeStringToFile(new File(pageSourceLocation + d.getTestClass().getSimpleName() + "/" + d.getMethodName() + ".html"),
driver.getPageSource());
}
} catch (IllegalStateException ex) {
Logger.getLogger(TestEventsLogger.class).warn(ex.getMessage());
}
}
}

View file

@ -43,7 +43,6 @@ import org.keycloak.models.LDAPConstants;
import org.keycloak.models.RealmModel;
import org.keycloak.models.RealmProvider;
import org.keycloak.models.UserModel;
import org.keycloak.models.mongo.keycloak.adapters.MongoRealmProviderFactory;
import org.keycloak.models.utils.UserModelDelegate;
import org.keycloak.representations.idm.ComponentRepresentation;
import org.keycloak.representations.idm.UserRepresentation;