use of org.activityinfo.test.sut.UserAccount in project activityinfo by bedatadriven.
the class CapacityTest method addScenario.
private void addScenario(Scenario scenario) {
ScenarioContext scenarioContext = new ScenarioContext(context);
DevServerAccounts accounts = scenarioContext.getAccounts();
accounts.setBatchingEnabled(true);
for (UserRole user : scenario.getUsers()) {
UserAccount account = accounts.ensureAccountExists(user.getNickName());
LOGGER.fine(String.format("Created User: %s: %s", account.getEmail(), user.getNickName()));
}
accounts.flush();
scenarios.add(scenario);
}
use of org.activityinfo.test.sut.UserAccount in project activityinfo by bedatadriven.
the class DataEntrySteps method field_s_downloadable_link_is_forbidden_for.
@Then("^\"([^\"]*)\" field's downloadable link is forbidden for \"([^\"]*)\"$")
public void field_s_downloadable_link_is_forbidden_for(String attachmentFieldName, String userEmail) throws Throwable {
UserAccount account = accounts.ensureAccountExists(userEmail);
String blobLink = firstDownloadableLinkOfFirstSubmission(attachmentFieldName);
Client client = new Client();
client.addFilter(new HTTPBasicAuthFilter(account.getEmail(), account.getPassword()));
client.setFollowRedirects(false);
ClientResponse clientResponse = client.resource(blobLink).get(ClientResponse.class);
assertEquals(Response.Status.UNAUTHORIZED.getStatusCode(), clientResponse.getStatus());
}
use of org.activityinfo.test.sut.UserAccount in project activityinfo by bedatadriven.
the class JsonApiSteps method user_executes_the_command.
@When("([^ ]+) executes the command:$")
public void user_executes_the_command(String accountEmail, String requestBody) throws Throwable {
UserAccount user = accounts.ensureAccountExists(accountEmail);
execute(user, requestBody);
}
use of org.activityinfo.test.sut.UserAccount in project activityinfo by bedatadriven.
the class LoginSteps method I_login_as_with_my_password.
@When("^I login as \"([^\"]*)\" with my correct password$")
public void I_login_as_with_my_password(String email) throws Throwable {
UserAccount account = accounts.ensureAccountExists(email);
logoutIfloggedIn();
loginPage.navigateTo().loginAs(account);
}
use of org.activityinfo.test.sut.UserAccount in project activityinfo by bedatadriven.
the class LoginSteps method that_I_am_logged_in_as.
@Given("^that I am logged in as \"([^\"]*)\"$")
public void that_I_am_logged_in_as(String email) throws Throwable {
UserAccount account = accounts.ensureAccountExists(email);
loginPage.navigateTo().loginAs(account).andExpectSuccess();
}
Aggregations