Search in sources :

Example 31 with PostRequest

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

the class IssuesServiceTest method do_transition.

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

Example 32 with PostRequest

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

the class PermissionsServiceTest method applyTemplate_does_POST_on_Ws_apply_template.

@Test
public void applyTemplate_does_POST_on_Ws_apply_template() {
    underTest.applyTemplate(new ApplyTemplateWsRequest().setProjectId(PROJECT_ID_VALUE).setProjectKey(PROJECT_KEY_VALUE).setTemplateId(TEMPLATE_ID_VALUE).setTemplateName(TEMPLATE_NAME_VALUE));
    assertThat(serviceTester.getPostParser()).isNull();
    PostRequest postRequest = serviceTester.getPostRequest();
    serviceTester.assertThat(postRequest).hasPath("apply_template").hasParam(PARAM_PROJECT_ID, PROJECT_ID_VALUE).hasParam(PARAM_PROJECT_KEY, PROJECT_KEY_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 33 with PostRequest

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

the class PermissionsServiceTest method addGroup_does_POST_on_Ws_add_group.

@Test
public void addGroup_does_POST_on_Ws_add_group() {
    underTest.addGroup(new AddGroupWsRequest().setPermission(PERMISSION_VALUE).setProjectId(PROJECT_ID_VALUE).setProjectKey(PROJECT_KEY_VALUE).setGroupId(GROUP_ID_VALUE).setGroupName(GROUP_NAME_VALUE));
    assertThat(serviceTester.getPostParser()).isNull();
    PostRequest postRequest = serviceTester.getPostRequest();
    serviceTester.assertThat(postRequest).hasPath("add_group").hasParam(PARAM_PERMISSION, PERMISSION_VALUE).hasParam(PARAM_PROJECT_ID, PROJECT_ID_VALUE).hasParam(PARAM_PROJECT_KEY, PROJECT_KEY_VALUE).hasParam(PARAM_GROUP_ID, GROUP_ID_VALUE).hasParam(PARAM_GROUP_NAME, GROUP_NAME_VALUE).andNoOtherParam();
}
Also used : PostRequest(org.sonarqube.ws.client.PostRequest) Test(org.junit.Test)

Example 34 with PostRequest

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

the class PermissionsServiceTest method removeGroup_does_POST_on_Ws_remove_group.

@Test
public void removeGroup_does_POST_on_Ws_remove_group() {
    underTest.removeGroup(new RemoveGroupWsRequest().setPermission(PERMISSION_VALUE).setGroupId(GROUP_ID_VALUE).setGroupName(GROUP_NAME_VALUE).setProjectId(PROJECT_ID_VALUE).setProjectKey(PROJECT_KEY_VALUE));
    assertThat(serviceTester.getPostParser()).isNull();
    PostRequest postRequest = serviceTester.getPostRequest();
    serviceTester.assertThat(postRequest).hasPath("remove_group").hasParam(PARAM_PERMISSION, PERMISSION_VALUE).hasParam(PARAM_GROUP_ID, GROUP_ID_VALUE).hasParam(PARAM_GROUP_NAME, GROUP_NAME_VALUE).hasParam(PARAM_PROJECT_ID, PROJECT_ID_VALUE).hasParam(PARAM_PROJECT_KEY, PROJECT_KEY_VALUE).andNoOtherParam();
}
Also used : PostRequest(org.sonarqube.ws.client.PostRequest) Test(org.junit.Test)

Example 35 with PostRequest

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

the class PermissionsServiceTest method remove_project_creator_from_template.

@Test
public void remove_project_creator_from_template() {
    underTest.removeProjectCreatorFromTemplate(RemoveProjectCreatorFromTemplateWsRequest.builder().setPermission(PERMISSION_VALUE).setTemplateId(TEMPLATE_ID_VALUE).setTemplateName(TEMPLATE_NAME_VALUE).build());
    assertThat(serviceTester.getPostParser()).isNull();
    PostRequest getRequest = serviceTester.getPostRequest();
    serviceTester.assertThat(getRequest).hasPath("remove_project_creator_from_template").hasParam(PARAM_PERMISSION, PERMISSION_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)

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