Search in sources :

Example 6 with UserAccount

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);
}
Also used : ScenarioContext(org.activityinfo.test.capacity.model.ScenarioContext) UserRole(org.activityinfo.test.capacity.model.UserRole) DevServerAccounts(org.activityinfo.test.sut.DevServerAccounts) UserAccount(org.activityinfo.test.sut.UserAccount)

Example 7 with UserAccount

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());
}
Also used : ClientResponse(com.sun.jersey.api.client.ClientResponse) Client(com.sun.jersey.api.client.Client) UserAccount(org.activityinfo.test.sut.UserAccount) HTTPBasicAuthFilter(com.sun.jersey.api.client.filter.HTTPBasicAuthFilter) Then(cucumber.api.java.en.Then)

Example 8 with UserAccount

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);
}
Also used : UserAccount(org.activityinfo.test.sut.UserAccount) When(cucumber.api.java.en.When)

Example 9 with UserAccount

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);
}
Also used : UserAccount(org.activityinfo.test.sut.UserAccount) When(cucumber.api.java.en.When)

Example 10 with UserAccount

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();
}
Also used : UserAccount(org.activityinfo.test.sut.UserAccount) Given(cucumber.api.java.en.Given)

Aggregations

UserAccount (org.activityinfo.test.sut.UserAccount)10 Client (com.sun.jersey.api.client.Client)2 ClientResponse (com.sun.jersey.api.client.ClientResponse)2 HTTPBasicAuthFilter (com.sun.jersey.api.client.filter.HTTPBasicAuthFilter)2 Given (cucumber.api.java.en.Given)2 Then (cucumber.api.java.en.Then)2 When (cucumber.api.java.en.When)2 And (cucumber.api.java.en.And)1 ScenarioContext (org.activityinfo.test.capacity.model.ScenarioContext)1 UserRole (org.activityinfo.test.capacity.model.UserRole)1 GxtModal (org.activityinfo.test.pageobject.gxt.GxtModal)1 DevServerAccounts (org.activityinfo.test.sut.DevServerAccounts)1 JSONObject (org.json.JSONObject)1