@Test
  public void add_user_nominal() throws Exception {
    GroupDto group = insertGroup("admins");
    UserDto user = insertUser("my-admin");
    session.commit();

    userSession.login("admin").setGlobalPermissions(GlobalPermissions.SYSTEM_ADMIN);
    tester
        .newPostRequest("api/usergroups", "add_user")
        .setParam("id", group.getId().toString())
        .setParam("login", user.getLogin())
        .execute()
        .assertNoContent();

    assertThat(
            groupMembershipDao
                .selectGroupsByLogins(session, Arrays.asList(user.getLogin()))
                .get(user.getLogin()))
        .containsOnly(group.getName());
  }
  @Test
  public void add_another_user_to_group() throws Exception {
    GroupDto users = insertGroup("user");
    UserDto user1 = insertUser("user1");
    UserDto user2 = insertUser("user2");
    insertMember(users.getId(), user1.getId());
    session.commit();

    userSession.login("admin").setGlobalPermissions(GlobalPermissions.SYSTEM_ADMIN);
    tester
        .newPostRequest("api/usergroups", "add_user")
        .setParam("id", users.getId().toString())
        .setParam("login", user2.getLogin())
        .execute()
        .assertNoContent();

    Multimap<String, String> groupsByLogins =
        groupMembershipDao.selectGroupsByLogins(
            session, Arrays.asList(user1.getLogin(), user2.getLogin()));
    assertThat(groupsByLogins.get(user1.getLogin())).containsOnly(users.getName());
    assertThat(groupsByLogins.get(user2.getLogin())).containsOnly(users.getName());
  }