use of com.google.copybara.CommandEnv in project copybara by google.
the class OnboardCmdTest method testOnboardCmdTextAdventure.
@Test
public void testOnboardCmdTextAdventure() throws Exception {
TestingConsole console = new TestingConsole();
console.respondWithString("https://github.com/google/origin").respondWithString("https://github.com/google/destination").respondWithString("Copybara <copy@bara.com>");
optionsBuilder.setConsole(console);
OnboardCmd onboardCmd = new OnboardCmd();
ExitCode exit = onboardCmd.run(new CommandEnv(temp, skylark.createModuleSet().getOptions(), ImmutableList.of("copy.bara.sky")));
assertThat(exit).isEqualTo(ExitCode.SUCCESS);
ConfigBuilder expectedConfig = new ConfigBuilder(new GitToGitTemplate());
expectedConfig.setNamedStringParameter("origin_url", "https://github.com/google/origin");
expectedConfig.setNamedStringParameter("destination_url", "https://github.com/google/destination");
expectedConfig.setNamedStringParameter("email", "Copybara <copy@bara.com>");
assertThat(Joiner.on('\n').join(console.getMessages().stream().map(Message::getText).collect(Collectors.toList()))).contains(expectedConfig.build());
}
use of com.google.copybara.CommandEnv in project copybara by google.
the class CommandLineGuideTest method testGitToGitTemplatePredicateNotSatisfied.
@Test
public void testGitToGitTemplatePredicateNotSatisfied() {
String urlPrefix = "https://github.com/google/";
TestingConsole console = new TestingConsole();
console.respondWithString(urlPrefix.concat("origin")).respondWithString(urlPrefix.concat("destination")).respondWithString("not a valid email");
optionsBuilder.setConsole(console);
CommandLineGuide.runForCommandLine(new CommandEnv(temp, skylark.createModuleSet().getOptions(), ImmutableList.of("copy.bara.sky")));
assertThat(Joiner.on('\n').join(console.getMessages().stream().map(Message::getText).collect(Collectors.toList()))).contains("Invalid response");
}
use of com.google.copybara.CommandEnv in project copybara by google.
the class CommandLineGuideTest method testGitToGitTemplate.
@Test
public void testGitToGitTemplate() {
TestingConsole console = new TestingConsole();
String urlPrefix = "https://github.com/google/";
console.respondWithString(urlPrefix.concat("origin")).respondWithString(urlPrefix.concat("destination")).respondWithString("Copybara <copy@bara.com>");
optionsBuilder.setConsole(console);
CommandLineGuide.runForCommandLine(new CommandEnv(temp, skylark.createModuleSet().getOptions(), ImmutableList.of("copy.bara.sky")));
ConfigBuilder expectedConfig = new ConfigBuilder(new GitToGitTemplate());
expectedConfig.setNamedStringParameter("origin_url", urlPrefix.concat("origin"));
expectedConfig.setNamedStringParameter("destination_url", urlPrefix.concat("destination"));
expectedConfig.setNamedStringParameter("email", "Copybara <copy@bara.com>");
assertThat(Joiner.on('\n').join(console.getMessages().stream().map(Message::getText).collect(Collectors.toList()))).contains(expectedConfig.build());
}
Aggregations