use of com.facebook.buck.rage.UserInputFixture in project buck by facebook.
the class DoctorCommandIntegrationTest method testEndpointUrl.
@Test
public void testEndpointUrl() throws Exception {
DoctorReportHelper helper = createDoctorHelper((new UserInputFixture("0")).getUserInput(), DoctorConfig.of(FakeBuckConfig.builder().build()));
BuildLogHelper buildLogHelper = new BuildLogHelper(workspace.asCell().getFilesystem(), objectMapper);
Optional<BuildLogEntry> entry = helper.promptForBuild(new ArrayList<>(buildLogHelper.getBuildLogs()));
DoctorEndpointRequest request = helper.generateEndpointRequest(entry.get(), rageResult);
DoctorEndpointResponse response = helper.uploadRequest(request);
assertEquals("Please define URL", response.getErrorMessage().get(), "Doctor endpoint URL is not set. Please set [doctor] endpoint_url on your .buckconfig");
}
use of com.facebook.buck.rage.UserInputFixture in project buck by facebook.
the class DoctorReportHelperTest method testNoAvailableSuggestions.
@Test
public void testNoAvailableSuggestions() throws Exception {
TestConsole console = new TestConsole();
DoctorConfig doctorConfig = DoctorConfig.of(FakeBuckConfig.builder().setSections(ImmutableMap.of(DoctorConfig.DOCTOR_SECTION, ImmutableMap.of(DoctorConfig.URL_FIELD, "url"))).build());
DoctorReportHelper helper = new DoctorReportHelper(workspace.asCell().getFilesystem(), (new UserInputFixture("0")).getUserInput(), console, objectMapper, doctorConfig);
DoctorEndpointResponse response = DoctorEndpointResponse.of(Optional.empty(), ImmutableList.of());
helper.presentResponse(response);
assertEquals("\n:: No available suggestions right now.\n\n", console.getTextWrittenToStdOut());
}
use of com.facebook.buck.rage.UserInputFixture in project buck by facebook.
the class DoctorCommandIntegrationTest method testPromptWithoutRageReport.
@Test
public void testPromptWithoutRageReport() throws Exception {
assumeThat(Platform.detect(), Matchers.not(Matchers.is(Platform.WINDOWS)));
DoctorReportHelper helper = createDoctorHelper((new UserInputFixture("0")).getUserInput(), createDoctorConfig(httpd));
BuildLogHelper buildLogHelper = new BuildLogHelper(workspace.asCell().getFilesystem(), objectMapper);
Optional<BuildLogEntry> entry = helper.promptForBuild(new ArrayList<>(buildLogHelper.getBuildLogs()));
DoctorEndpointRequest request = helper.generateEndpointRequest(entry.get(), rageResult);
DoctorEndpointResponse response = helper.uploadRequest(request);
helper.presentResponse(response);
assertEquals(response, doctorResponse);
assertEquals("\n:: Suggestions\n- [Error] Suggestion no1\n- [Warning][Area] Suggestion no2\n\n", ((TestConsole) helper.getConsole()).getTextWrittenToStdOut());
}
use of com.facebook.buck.rage.UserInputFixture in project buck by facebook.
the class DoctorReportHelperTest method testErrorMessage.
@Test
public void testErrorMessage() throws Exception {
TestConsole console = new TestConsole();
DoctorConfig doctorConfig = DoctorConfig.of(FakeBuckConfig.builder().setSections(ImmutableMap.of(DoctorConfig.DOCTOR_SECTION, ImmutableMap.of(DoctorConfig.URL_FIELD, "url"))).build());
DoctorReportHelper helper = new DoctorReportHelper(workspace.asCell().getFilesystem(), (new UserInputFixture("0")).getUserInput(), console, objectMapper, doctorConfig);
String errorMessage = "This is an error message.";
DoctorEndpointResponse response = DoctorEndpointResponse.of(Optional.of(errorMessage), ImmutableList.of());
helper.presentResponse(response);
assertEquals("=> " + errorMessage + "\n", console.getTextWrittenToStdOut());
}
Aggregations