use of org.olat.user.restapi.UserVO in project OpenOLAT by OpenOLAT.
the class LoginTest method loginAsNewUser.
/**
* Create a new user and try to login with its credentials.
*
* @param loginPage
* @throws IOException
* @throws URISyntaxException
*/
@Test
@RunAsClient
public void loginAsNewUser(@InitialPage LoginPage loginPage) throws IOException, URISyntaxException {
// create a random user
UserRestClient userClient = new UserRestClient(deploymentUrl);
UserVO user = userClient.createRandomUser();
// load dmz
loginPage.assertOnLoginPage();
// login
loginPage.loginAs(user.getLogin(), user.getPassword());
}
use of org.olat.user.restapi.UserVO in project OpenOLAT by OpenOLAT.
the class CatalogTest method testGetOwners.
@Test
public void testGetOwners() throws IOException, URISyntaxException {
RestConnection conn = new RestConnection();
assertTrue(conn.login("administrator", "openolat"));
URI uri = UriBuilder.fromUri(getContextURI()).path("catalog").path(entry1.getKey().toString()).path("owners").build();
HttpGet method = conn.createGet(uri, MediaType.APPLICATION_JSON, true);
HttpResponse response = conn.execute(method);
assertEquals(200, response.getStatusLine().getStatusCode());
InputStream body = response.getEntity().getContent();
List<UserVO> voes = parseUserArray(body);
assertNotNull(voes);
CatalogEntry entry = catalogManager.loadCatalogEntry(entry1.getKey());
List<Identity> identities = BaseSecurityManager.getInstance().getIdentitiesOfSecurityGroup(entry.getOwnerGroup());
assertNotNull(identities);
assertEquals(identities.size(), voes.size());
conn.shutdown();
}
use of org.olat.user.restapi.UserVO in project OpenOLAT by OpenOLAT.
the class UserTest method movePortletToTheTop.
/**
* Go to the portal, edit it, move the notes to the
* top, quit editing, check the notes are the first
* portlet in the view mode.
*
* @param loginPage
* @throws IOException
* @throws URISyntaxException
*/
@Test
@RunAsClient
public void movePortletToTheTop(@InitialPage LoginPage loginPage) throws IOException, URISyntaxException {
UserVO user = new UserRestClient(deploymentUrl).createRandomUser();
loginPage.loginAs(user.getLogin(), user.getPassword());
PortalPage portal = navBar.openPortal().assertPortlet(PortalPage.notesBy).edit().moveLeft(PortalPage.notesBy).moveUp(PortalPage.notesBy).moveUp(PortalPage.notesBy).moveUp(PortalPage.notesBy).moveRight(PortalPage.quickStartBy).moveDown(PortalPage.quickStartBy);
// finish editing
portal.finishEditing();
// no inactive panel -> we are in view mode
List<WebElement> portalInactive = browser.findElements(PortalPage.inactiveBy);
Assert.assertTrue(portalInactive.isEmpty());
// notes must be first
List<WebElement> portlets = browser.findElements(By.className("o_portlet"));
Assert.assertFalse(portlets.isEmpty());
WebElement notesPortlet = portlets.get(0);
String cssClass = notesPortlet.getAttribute("class");
Assert.assertNotNull(cssClass);
Assert.assertTrue(cssClass.contains("o_portlet_notes"));
}
use of org.olat.user.restapi.UserVO in project OpenOLAT by OpenOLAT.
the class UserTest method userSwitchLanguageSwitchToEnglish.
/**
* Switch the language to german and after logout login to english
* and check every time.
*
* @param loginPage
* @throws IOException
* @throws URISyntaxException
*/
@Test
@RunAsClient
public void userSwitchLanguageSwitchToEnglish(@InitialPage LoginPage loginPage) throws IOException, URISyntaxException {
UserVO user = new UserRestClient(deploymentUrl).createRandomUser();
loginPage.loginAs(user.getLogin(), user.getPassword()).resume();
// set the languages preferences to german
UserToolsPage userTools = new UserToolsPage(browser);
userTools.openUserToolsMenu().openMySettings().assertOnUserSettings().openPreferences().assertOnUserPreferences().setLanguage("de");
userTools.logout();
loginPage.loginAs(user.getLogin(), user.getPassword()).resume();
WebElement usernameDE = browser.findElement(LoginPage.usernameFooterBy);
boolean de = usernameDE.getText().contains("Eingeloggt als");
Assert.assertTrue(de);
List<WebElement> deMarker = browser.findElements(By.className("o_lang_de"));
Assert.assertFalse(deMarker.isEmpty());
// set the languages preferences to english
userTools.openUserToolsMenu().openMySettings().openPreferences().setLanguage("en");
userTools.logout();
loginPage.loginAs(user.getLogin(), user.getPassword()).resume();
WebElement usernameEN = browser.findElement(LoginPage.usernameFooterBy);
boolean en = usernameEN.getText().contains("Logged in as");
Assert.assertTrue(en);
List<WebElement> enMarker = browser.findElements(By.className("o_lang_en"));
Assert.assertFalse(enMarker.isEmpty());
}
use of org.olat.user.restapi.UserVO in project OpenOLAT by OpenOLAT.
the class UserTest method userResetItsPreferences.
/**
* Reset the preferences and check that a log out happens
*
* @param loginPage
* @throws IOException
* @throws URISyntaxException
*/
@Test
@RunAsClient
public void userResetItsPreferences(@InitialPage LoginPage loginPage) throws IOException, URISyntaxException {
UserVO user = new UserRestClient(deploymentUrl).createRandomUser();
loginPage.loginAs(user.getLogin(), user.getPassword()).resume();
UserToolsPage userTools = new UserToolsPage(browser);
UserPreferencesPageFragment prefs = userTools.openUserToolsMenu().openMySettings().openPreferences();
// reset the preferences
prefs.resetPreferences();
// check the user is log out
loginPage.assertOnLoginPage();
}
Aggregations