use of org.sonarqube.ws.client.organization.CreateWsRequest in project sonarqube by SonarSource.
the class OrganizationTest method create_fails_if_user_is_not_root.
@Test
public void create_fails_if_user_is_not_root() {
userRule.createUser("foo", "bar");
CreateWsRequest createWsRequest = new CreateWsRequest.Builder().setName("bla bla").build();
OrganizationService fooUserOrganizationService = ItUtils.newUserWsClient(orchestrator, "foo", "bar").organizations();
expect403HttpError(() -> fooUserOrganizationService.create(createWsRequest));
userRule.setRoot("foo");
assertThat(fooUserOrganizationService.create(createWsRequest).getOrganization().getKey()).isEqualTo("bla-bla");
// delete org, attempt recreate when no root anymore and ensure it can't anymore
fooUserOrganizationService.delete("bla-bla");
userRule.unsetRoot("foo");
expect403HttpError(() -> fooUserOrganizationService.create(createWsRequest));
}
Aggregations