use of org.activityinfo.test.sut.UserAccount in project activityinfo by bedatadriven.
the class DataEntrySteps method field_has_downloadable_link.
@Then("^\"([^\"]*)\" field has downloadable link.$")
public void field_has_downloadable_link(String attachmentFieldName) throws Throwable {
String blobLink = firstDownloadableLinkOfFirstSubmission(attachmentFieldName);
UserAccount currentUser = driver.setup().getCurrentUser();
Client client = new Client();
client.addFilter(new HTTPBasicAuthFilter(currentUser.getEmail(), currentUser.getPassword()));
client.setFollowRedirects(false);
ClientResponse clientResponse = client.resource(blobLink).get(ClientResponse.class);
assertEquals(Response.Status.OK.getStatusCode(), clientResponse.getStatus());
}
use of org.activityinfo.test.sut.UserAccount in project activityinfo by bedatadriven.
the class DatabaseSetupSteps method createDatabase.
@Given("I have created a database \"(.*)\" in (.+)")
public void createDatabase(String databaseName, String countryName) throws Exception {
UserAccount account = accounts.any();
driver.login(account);
driver.setup().createDatabase(name(databaseName), property("country", countryName));
this.currentDatabase = databaseName;
}
use of org.activityinfo.test.sut.UserAccount in project activityinfo by bedatadriven.
the class SignUpSteps method I_try_to_choose_the_password.
@And("^I choose the password \"([^\"]*)\"$")
public void I_try_to_choose_the_password(String password) throws Throwable {
applicationPage = confirmPage.confirmPassword(password);
newUserAccount = new UserAccount(newUserAccount.getEmail(), password);
}
use of org.activityinfo.test.sut.UserAccount in project activityinfo by bedatadriven.
the class UiApplicationDriver method addUserToDatabase.
public void addUserToDatabase(String userEmail, String databaseName, String partner, List<FieldValue> permissions) {
UserAccount account = accounts.ensureAccountExists(userEmail);
ensureLoggedIn();
UsersPage usersPage = applicationPage.navigateToDesignTab().selectDatabase(getAliasTable().getAlias(databaseName)).users();
GxtModal modal = usersPage.addUser();
modal.form().fillTextField("Name", account.getEmail());
modal.form().fillTextField("Email", account.getEmail());
modal.form().select("Partner", getAliasTable().getAlias(partner));
modal.accept();
Sleep.sleepSeconds(1);
usersPage.setPermission(account.getEmail(), permissions);
}
use of org.activityinfo.test.sut.UserAccount in project activityinfo by bedatadriven.
the class ApiApplicationDriver method grantPermission.
@Override
public void grantPermission(TestObject properties) throws Exception {
UserAccount email = accounts.ensureAccountExists(properties.getString("user"));
JSONObject model = new JSONObject();
model.put("name", "A User");
model.put("email", email.getEmail());
model.put("partnerId", aliases.getId(properties.getString("partner")));
for (String permission : properties.getStringList("permissions")) {
switch(permission) {
case "View":
model.put("allowView", true);
break;
case "View All":
model.put("allowViewAll", true);
break;
case "Edit":
model.put("allowEdit", true);
break;
case "Edit All":
model.put("allowEditAll", true);
break;
case "Manage Users":
model.put("allowManageUsers", true);
break;
case "Manage All Users":
model.put("allowManageAllUsers", true);
break;
case "Design":
model.put("allowDesign", true);
break;
}
}
JSONObject command = new JSONObject();
command.put("databaseId", aliases.getId(properties.getString("database")));
command.put("model", model);
LOGGER.fine(format("Granting access to database '%s' [%d] to %s [%s] within %s [%d]", properties.getString("database"), command.getInt("databaseId"), properties.getString("user"), email.getEmail(), properties.getString("partner"), model.getInt("partnerId")));
executeCommand("UpdateUserPermissions", command);
}
Aggregations