Search in sources :

Example 16 with PostRequest

use of org.sonarqube.ws.client.PostRequest in project sonarqube by SonarSource.

the class IssuesServiceTest method set_severity.

@Test
public void set_severity() {
    underTest.setSeverity(new SetSeverityRequest("ABCD", "confirm"));
    PostRequest request = serviceTester.getPostRequest();
    assertThat(serviceTester.getPostParser()).isSameAs(Issues.Operation.parser());
    serviceTester.assertThat(request).hasParam("issue", "ABCD").hasParam("severity", "confirm").andNoOtherParam();
}
Also used : PostRequest(org.sonarqube.ws.client.PostRequest) Test(org.junit.Test)

Example 17 with PostRequest

use of org.sonarqube.ws.client.PostRequest in project sonarqube by SonarSource.

the class IssuesServiceTest method edit_comment.

@Test
public void edit_comment() {
    underTest.editComment(new EditCommentRequest("ABCD", "Please help me to fix this issue"));
    PostRequest request = serviceTester.getPostRequest();
    assertThat(serviceTester.getPostParser()).isSameAs(Issues.Operation.parser());
    serviceTester.assertThat(request).hasParam("comment", "ABCD").hasParam("text", "Please help me to fix this issue").andNoOtherParam();
}
Also used : PostRequest(org.sonarqube.ws.client.PostRequest) Test(org.junit.Test)

Example 18 with PostRequest

use of org.sonarqube.ws.client.PostRequest in project sonarqube by SonarSource.

the class PermissionsServiceTest method removeGroupFromTemplate_does_POST_on_Ws_remove_group_from_template.

@Test
public void removeGroupFromTemplate_does_POST_on_Ws_remove_group_from_template() {
    underTest.removeGroupFromTemplate(new RemoveGroupFromTemplateWsRequest().setPermission(PERMISSION_VALUE).setGroupId(GROUP_ID_VALUE).setGroupName(GROUP_NAME_VALUE).setTemplateId(TEMPLATE_ID_VALUE).setTemplateName(TEMPLATE_NAME_VALUE));
    assertThat(serviceTester.getPostParser()).isNull();
    PostRequest postRequest = serviceTester.getPostRequest();
    serviceTester.assertThat(postRequest).hasPath("remove_group_from_template").hasParam(PARAM_PERMISSION, PERMISSION_VALUE).hasParam(PARAM_GROUP_ID, GROUP_ID_VALUE).hasParam(PARAM_GROUP_NAME, GROUP_NAME_VALUE).hasParam(PARAM_TEMPLATE_ID, TEMPLATE_ID_VALUE).hasParam(PARAM_TEMPLATE_NAME, TEMPLATE_NAME_VALUE).andNoOtherParam();
}
Also used : PostRequest(org.sonarqube.ws.client.PostRequest) Test(org.junit.Test)

Example 19 with PostRequest

use of org.sonarqube.ws.client.PostRequest in project sonarqube by SonarSource.

the class PermissionsServiceTest method deleteTemplate_does_POST_on_Ws_delete_template.

@Test
public void deleteTemplate_does_POST_on_Ws_delete_template() {
    underTest.deleteTemplate(new DeleteTemplateWsRequest().setTemplateId(TEMPLATE_ID_VALUE).setTemplateName(TEMPLATE_NAME_VALUE));
    assertThat(serviceTester.getPostParser()).isNull();
    PostRequest postRequest = serviceTester.getPostRequest();
    serviceTester.assertThat(postRequest).hasPath("delete_template").hasParam(PARAM_TEMPLATE_ID, TEMPLATE_ID_VALUE).hasParam(PARAM_TEMPLATE_NAME, TEMPLATE_NAME_VALUE).andNoOtherParam();
}
Also used : PostRequest(org.sonarqube.ws.client.PostRequest) Test(org.junit.Test)

Example 20 with PostRequest

use of org.sonarqube.ws.client.PostRequest in project sonarqube by SonarSource.

the class PermissionsServiceTest method updateTemplate_does_POST_on_Ws_update_template.

@Test
public void updateTemplate_does_POST_on_Ws_update_template() {
    underTest.updateTemplate(new UpdateTemplateWsRequest().setDescription(DESCRIPTION_VALUE).setId(TEMPLATE_ID_VALUE).setName(TEMPLATE_NAME_VALUE).setProjectKeyPattern(PROJECT_KEY_PATTERN_VALUE));
    assertThat(serviceTester.getPostParser()).isSameAs(WsPermissions.UpdateTemplateWsResponse.parser());
    PostRequest postRequest = serviceTester.getPostRequest();
    serviceTester.assertThat(postRequest).hasPath("update_template").hasParam(PARAM_DESCRIPTION, DESCRIPTION_VALUE).hasParam(PARAM_ID, TEMPLATE_ID_VALUE).hasParam(PARAM_NAME, TEMPLATE_NAME_VALUE).hasParam(PARAM_PROJECT_KEY_PATTERN, PROJECT_KEY_PATTERN_VALUE).andNoOtherParam();
}
Also used : PostRequest(org.sonarqube.ws.client.PostRequest) Test(org.junit.Test)

Aggregations

PostRequest (org.sonarqube.ws.client.PostRequest)44 Test (org.junit.Test)33 MimeMessage (javax.mail.internet.MimeMessage)2 Before (org.junit.Before)2 WsClient (org.sonarqube.ws.client.WsClient)2 WsResponse (org.sonarqube.ws.client.WsResponse)2 WiserMessage (org.subethamail.wiser.WiserMessage)2 ItUtils.newAdminWsClient (util.ItUtils.newAdminWsClient)2 ItUtils.newUserWsClient (util.ItUtils.newUserWsClient)2 VisibleForTesting (com.google.common.annotations.VisibleForTesting)1 SonarScanner (com.sonar.orchestrator.build.SonarScanner)1 IOException (java.io.IOException)1 InputStream (java.io.InputStream)1 BeforeClass (org.junit.BeforeClass)1 ProjectDefinition (org.sonar.api.batch.bootstrap.ProjectDefinition)1 MessageException (org.sonar.api.utils.MessageException)1 QualityGate (org.sonar.wsclient.qualitygate.QualityGate)1 HttpException (org.sonarqube.ws.client.HttpException)1 Wiser (org.subethamail.wiser.Wiser)1 ProjectsPage (pageobjects.projects.ProjectsPage)1