Ejemplo n.º 1
0
  @Test
  public void search_with_selection() {
    String result =
        ws.newRequest()
            .setParam(PARAM_PERMISSION, GlobalPermissions.SCAN_EXECUTION)
            .setParam(SELECTED, SelectionMode.ALL.value())
            .execute()
            .getInput();

    assertThat(result).containsSequence(DefaultGroups.ANYONE, "group-1", "group-2", "group-3");
  }
Ejemplo n.º 2
0
  @Test
  public void search_with_admin_does_not_return_anyone() {
    String result =
        ws.newRequest()
            .setParam(PARAM_PERMISSION, GlobalPermissions.SYSTEM_ADMIN)
            .setParam(SELECTED, SelectionMode.ALL.value())
            .execute()
            .getInput();

    assertThat(result)
        .containsSequence("group-1", "group-2", "group-3")
        .doesNotContain(DefaultGroups.ANYONE);
  }
Ejemplo n.º 3
0
  @Test
  public void paging() throws Exception {
    GroupDto group = insertGroup();
    UserDto groupUser = insertUser("ada", "Ada Lovelace");
    insertUser("grace", "Grace Hopper");
    addUserToGroup(groupUser, group);
    session.commit();

    newUsersRequest()
        .setParam("id", group.getId().toString())
        .setParam("ps", "1")
        .setParam(Param.SELECTED, SelectionMode.ALL.value())
        .execute()
        .assertJson(getClass(), "all_page1.json");

    newUsersRequest()
        .setParam("id", group.getId().toString())
        .setParam("ps", "1")
        .setParam("p", "2")
        .setParam(Param.SELECTED, SelectionMode.ALL.value())
        .execute()
        .assertJson(getClass(), "all_page2.json");
  }