Search in sources :

Example 66 with TestResponse

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

the class OrganizationActionTest method verify_example.

@Test
public void verify_example() {
    OrganizationDto organization = dbTester.organizations().insert(dto -> dto.setGuarded(true));
    userSession.logIn().addPermission(ADMINISTER, organization).addPermission(PROVISION_PROJECTS, organization);
    TestResponse response = executeRequest(organization);
    assertJson(response.getInput()).isSimilarTo(underTest.getDef().responseExampleAsString());
}
Also used : TestResponse(org.sonar.server.ws.TestResponse) OrganizationDto(org.sonar.db.organization.OrganizationDto) Test(org.junit.Test)

Example 67 with TestResponse

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

the class SearchActionTest method newRequest.

private SearchWsResponse newRequest(@Nullable String login) {
    TestRequest testRequest = ws.newRequest().setMediaType(MediaTypes.PROTOBUF);
    if (login != null) {
        testRequest.setParam(PARAM_LOGIN, login);
    }
    TestResponse response = testRequest.execute();
    try {
        return SearchWsResponse.parseFrom(response.getInputStream());
    } catch (IOException e) {
        Throwables.propagate(e);
    }
    throw new IllegalStateException("unreachable");
}
Also used : TestResponse(org.sonar.server.ws.TestResponse) IOException(java.io.IOException) TestRequest(org.sonar.server.ws.TestRequest)

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