use of org.sonar.db.organization.OrganizationDto in project sonarqube by SonarSource.
the class CreateActionTest method create_group_on_specific_organization.
@Test
public void create_group_on_specific_organization() throws Exception {
OrganizationDto org = db.organizations().insert();
loginAsAdmin(org);
newRequest().setParam("organization", org.getKey()).setParam("name", "some-product-bu").setParam("description", "Business Unit for Some Awesome Product").execute().assertJson("{" + " \"group\": {" + " \"organization\": \"" + org.getKey() + "\"," + " \"name\": \"some-product-bu\"," + " \"description\": \"Business Unit for Some Awesome Product\"," + " \"membersCount\": 0" + " }" + "}");
GroupDto createdGroup = db.users().selectGroup(org, "some-product-bu").get();
assertThat(createdGroup.getId()).isNotNull();
assertThat(createdGroup.getOrganizationUuid()).isEqualTo(org.getUuid());
}
use of org.sonar.db.organization.OrganizationDto in project sonarqube by SonarSource.
the class DeleteActionTest method delete_admin_group_succeeds_if_other_groups_have_administrators.
@Test
public void delete_admin_group_succeeds_if_other_groups_have_administrators() throws Exception {
OrganizationDto org = db.organizations().insert();
GroupDto adminGroup1 = db.users().insertGroup(org, "admins");
db.users().insertPermissionOnGroup(adminGroup1, SYSTEM_ADMIN);
GroupDto adminGroup2 = db.users().insertGroup(org, "admins");
db.users().insertPermissionOnGroup(adminGroup2, SYSTEM_ADMIN);
UserDto bigBoss = db.users().insertUser();
db.users().insertMember(adminGroup2, bigBoss);
loginAsAdmin(org);
executeDeleteGroupRequest(adminGroup1);
assertThat(db.users().selectGroupPermissions(adminGroup2, null)).hasSize(1);
}
use of org.sonar.db.organization.OrganizationDto in project sonarqube by SonarSource.
the class DeleteActionTest method delete_by_name_fails_if_organization_is_not_correct.
@Test
public void delete_by_name_fails_if_organization_is_not_correct() throws Exception {
OrganizationDto org = db.organizations().insert();
loginAsAdmin(org);
expectedException.expect(NotFoundException.class);
expectedException.expectMessage("No organization with key 'missing'");
newRequest().setParam(PARAM_ORGANIZATION_KEY, "missing").setParam(PARAM_GROUP_NAME, "a-group").execute();
}
use of org.sonar.db.organization.OrganizationDto in project sonarqube by SonarSource.
the class DeleteActionTest method delete_group_of_an_organization_even_if_name_is_default_group_of_default_organization.
@Test
public void delete_group_of_an_organization_even_if_name_is_default_group_of_default_organization() throws Exception {
OrganizationDto org = db.organizations().insert();
addAdmin(org);
GroupDto group = db.users().insertGroup(org, defaultGroup.getName());
loginAsAdmin(org);
newRequest().setParam("id", group.getId().toString()).execute();
assertThat(db.users().selectGroupById(defaultGroup.getId())).isNotNull();
assertThat(db.users().selectGroupById(group.getId())).isNull();
}
use of org.sonar.db.organization.OrganizationDto in project sonarqube by SonarSource.
the class UpdateActionTest method fails_if_admin_of_another_organization_only.
@Test
public void fails_if_admin_of_another_organization_only() throws Exception {
OrganizationDto org1 = db.organizations().insert();
OrganizationDto org2 = db.organizations().insert();
GroupDto group = db.users().insertGroup(org1, "group1");
loginAsAdmin(org2);
expectedException.expect(ForbiddenException.class);
newRequest().setParam("id", group.getId().toString()).setParam("name", "some-product-bu").setParam("description", "Business Unit for Some Awesome Product").execute();
}
Aggregations