Search in sources :

Example 46 with TestResponse

use of org.sonar.server.ws.TestResponse in project sonarqube by SonarSource.

the class AddActionTest method http_no_content.

@Test
public void http_no_content() {
    TestResponse result = call(request);
    assertThat(result.getStatus()).isEqualTo(HTTP_NO_CONTENT);
}
Also used : TestResponse(org.sonar.server.ws.TestResponse) Test(org.junit.Test)

Example 47 with TestResponse

use of org.sonar.server.ws.TestResponse in project sonarqube by SonarSource.

the class EnableSupportActionTest method call.

private void call() {
    TestResponse response = tester.newRequest().setMethod("POST").execute();
    assertThat(response.getStatus()).isEqualTo(HttpURLConnection.HTTP_NO_CONTENT);
}
Also used : TestResponse(org.sonar.server.ws.TestResponse)

Example 48 with TestResponse

use of org.sonar.server.ws.TestResponse in project sonarqube by SonarSource.

the class RemoveActionTest method http_no_content.

@Test
public void http_no_content() {
    notificationUpdater.add(dbSession, defaultChannel.getKey(), NOTIF_MY_NEW_ISSUES, null);
    dbSession.commit();
    TestResponse result = call(request);
    assertThat(result.getStatus()).isEqualTo(HTTP_NO_CONTENT);
}
Also used : TestResponse(org.sonar.server.ws.TestResponse) Test(org.junit.Test)

Example 49 with TestResponse

use of org.sonar.server.ws.TestResponse in project sonarqube by SonarSource.

the class DeleteTemplateActionTest method delete_template_in_db.

@Test
public void delete_template_in_db() throws Exception {
    runOnAllUnderTests((underTest) -> {
        OrganizationDto organization = db.organizations().insert();
        PermissionTemplateDto template = insertTemplateAndAssociatedPermissions(organization);
        db.organizations().setDefaultTemplates(db.permissionTemplates().insertTemplate(organization), db.permissionTemplates().insertTemplate(organization));
        loginAsAdmin(organization);
        TestResponse result = newRequestByUuid(underTest, template.getUuid());
        assertThat(result.getInput()).isEmpty();
        assertTemplateDoesNotExist(template);
    });
}
Also used : PermissionTemplateDto(org.sonar.db.permission.template.PermissionTemplateDto) TestResponse(org.sonar.server.ws.TestResponse) OrganizationDto(org.sonar.db.organization.OrganizationDto) Test(org.junit.Test)

Example 50 with TestResponse

use of org.sonar.server.ws.TestResponse in project sonarqube by SonarSource.

the class LogsActionTest method get_es_logs.

@Test
public void get_es_logs() throws IOException {
    logInAsSystemAdministrator();
    createAllLogsFiles();
    TestResponse response = actionTester.newRequest().setParam("process", "es").execute();
    assertThat(response.getMediaType()).isEqualTo(MediaTypes.TXT);
    assertThat(response.getInput()).isEqualTo("{es}");
}
Also used : TestResponse(org.sonar.server.ws.TestResponse) Test(org.junit.Test)

Aggregations

TestResponse (org.sonar.server.ws.TestResponse)67 Test (org.junit.Test)64 OrganizationDto (org.sonar.db.organization.OrganizationDto)18 WsCe (org.sonarqube.ws.WsCe)13 ComponentDto (org.sonar.db.component.ComponentDto)9 CeActivityDto (org.sonar.db.ce.CeActivityDto)4 InputStream (java.io.InputStream)2 Date (java.util.Date)2 PermissionTemplateDto (org.sonar.db.permission.template.PermissionTemplateDto)2 UserDto (org.sonar.db.user.UserDto)2 ProjectRepositories (org.sonar.scanner.protocol.input.ProjectRepositories)2 File (java.io.File)1 IOException (java.io.IOException)1 LinkedHashMap (java.util.LinkedHashMap)1 CeQueueDto (org.sonar.db.ce.CeQueueDto)1 ComponentLinkDto (org.sonar.db.component.ComponentLinkDto)1 IssueDto (org.sonar.db.issue.IssueDto)1 PropertyDto (org.sonar.db.property.PropertyDto)1 RuleDto (org.sonar.db.rule.RuleDto)1 FileData (org.sonar.scanner.protocol.input.FileData)1