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());
}
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");
}
Aggregations