use of org.sonarqube.ws.client.WsResponse in project sonarqube by SonarSource.
the class WsLocalCallTest method fails_if_requires_permissions.
@Test
public void fails_if_requires_permissions() {
WsResponse response = newWsClient(orchestrator).wsConnector().call(new GetRequest("local_ws_call/require_permission"));
// this is not the unauthorized code as plugin forces it to 500
assertThat(response.code()).isEqualTo(500);
}
use of org.sonarqube.ws.client.WsResponse in project sonarqube by SonarSource.
the class WsLocalCallTest method gets_json.
@Test
public void gets_json() {
WsResponse response = newWsClient(orchestrator).wsConnector().call(new GetRequest("local_ws_call/json_data"));
assertThat(response.isSuccessful()).isTrue();
}
use of org.sonarqube.ws.client.WsResponse in project sonarqube by SonarSource.
the class WsLocalCallTest method propagates_authorization_rights.
@Test
public void propagates_authorization_rights() {
WsClient wsClient = WsClientFactories.getDefault().newClient(HttpConnector.newBuilder().url(orchestrator.getServer().getUrl()).credentials("admin", "admin").build());
WsResponse response = wsClient.wsConnector().call(new GetRequest("local_ws_call/require_permission"));
assertThat(response.isSuccessful()).isTrue();
}
use of org.sonarqube.ws.client.WsResponse in project sonarqube by SonarSource.
the class WsTest method gets_json.
@Test
public void gets_json() {
WsResponse response = newWsClient(orchestrator).wsConnector().call(new GetRequest("api/issues/search.json"));
assertThat(response.isSuccessful()).isTrue();
assertThat(response.contentType()).contains("application/json");
}
use of org.sonarqube.ws.client.WsResponse in project sonarqube by SonarSource.
the class WsTest method fail_on_unknown_extension.
/**
* SONAR-7484
*/
@Test
public void fail_on_unknown_extension() {
WsResponse response = newWsClient(orchestrator).wsConnector().call(new GetRequest("api/issues/search.unknown"));
assertThat(response.isSuccessful()).isFalse();
assertThat(response.code()).isEqualTo(HTTP_BAD_REQUEST);
}
Aggregations