use of org.sonar.db.permission.template.PermissionTemplateDto in project sonarqube by SonarSource.
the class TemplateUsersActionTest method fail_if_not_logged_in.
@Test
public void fail_if_not_logged_in() throws Exception {
PermissionTemplateDto template = addTemplateToDefaultOrganization();
userSession.anonymous();
expectedException.expect(UnauthorizedException.class);
newRequest(null, template.getUuid()).execute();
}
use of org.sonar.db.permission.template.PermissionTemplateDto in project sonarqube by SonarSource.
the class TemplateUsersActionTest method fail_if_insufficient_privileges.
@Test
public void fail_if_insufficient_privileges() throws Exception {
PermissionTemplateDto template = addTemplateToDefaultOrganization();
userSession.logIn().addPermission(SCAN, db.getDefaultOrganization());
expectedException.expect(ForbiddenException.class);
newRequest(null, template.getUuid()).execute();
}
use of org.sonar.db.permission.template.PermissionTemplateDto in project sonarqube by SonarSource.
the class SetDefaultTemplateActionTest method fail_if_qualifier_is_not_root.
@Test
public void fail_if_qualifier_is_not_root() throws Exception {
OrganizationDto organization = db.organizations().insert();
PermissionTemplateDto template = insertTemplate(organization);
loginAsAdmin(organization);
expectedException.expect(IllegalArgumentException.class);
expectedException.expectMessage("Value of parameter 'qualifier' (FIL) must be one of: [TRK, VW]");
newRequest(template.getUuid(), Qualifiers.FILE);
}
use of org.sonar.db.permission.template.PermissionTemplateDto in project sonarqube by SonarSource.
the class SetDefaultTemplateActionTest method fail_if_organization_has_no_default_templates.
@Test
public void fail_if_organization_has_no_default_templates() throws Exception {
OrganizationDto organization = db.organizations().insert();
PermissionTemplateDto template = insertTemplate(organization);
loginAsAdmin(organization);
expectedException.expect(NotFoundException.class);
expectedException.expectMessage("No Default templates for organization with uuid '" + organization.getUuid() + "'");
newRequest(template.getUuid(), null);
}
use of org.sonar.db.permission.template.PermissionTemplateDto in project sonarqube by SonarSource.
the class SetDefaultTemplateActionTest method update_project_default_template_without_qualifier_param.
@Test
public void update_project_default_template_without_qualifier_param() throws Exception {
OrganizationDto organization = db.organizations().insert();
db.organizations().setDefaultTemplates(organization, "any-project-template-uuid", "any-view-template-uuid");
PermissionTemplateDto template = insertTemplate(organization);
loginAsAdmin(organization);
// default value is project qualifier's value
newRequest(template.getUuid(), null);
assertDefaultTemplates(organization, template.getUuid(), "any-view-template-uuid");
}
Aggregations