use of com.google.copybara.util.console.testing.TestingConsole in project copybara by google.
the class CopyOrMoveTest method testAbsoluteAfter.
@Test
public void testAbsoluteAfter() {
for (String t : ImmutableList.of("move", "copy")) {
options.setConsole(new TestingConsole());
skylark.evalFails("core." + t + "(after = '/blablabla', before = 'other')\n", "path must be relative.*/blablabla");
}
}
use of com.google.copybara.util.console.testing.TestingConsole in project copybara by google.
the class RemoveTest method setup.
@Before
public void setup() throws IOException {
FileSystem fs = Jimfs.newFileSystem();
checkoutDir = fs.getPath("/test-checkoutDir");
Files.createDirectories(checkoutDir);
console = new TestingConsole();
options = new OptionsBuilder().setConsole(console);
skylark = new SkylarkTestExecutor(options);
}
use of com.google.copybara.util.console.testing.TestingConsole in project copybara by google.
the class GithubArchiveTest method repoExceptionOnDownloadFailure.
@Test
public void repoExceptionOnDownloadFailure() throws Exception {
httpTransport = new MockHttpTransport() {
@Override
public LowLevelHttpRequest buildRequest(String method, String url) {
MockLowLevelHttpRequest request = new MockLowLevelHttpRequest() {
public LowLevelHttpResponse execute() throws IOException {
throw new IOException("OH NOES!");
}
};
return request;
}
};
RemoteFileOptions options = new RemoteFileOptions();
options.transport = () -> new GclientHttpStreamFactory(httpTransport, Duration.ofSeconds(20));
Console console = new TestingConsole();
OptionsBuilder optionsBuilder = new OptionsBuilder().setConsole(console);
optionsBuilder.remoteFile = options;
skylark = new SkylarkTestExecutor(optionsBuilder);
ValidationException e = assertThrows(ValidationException.class, () -> skylark.eval("sha256", "sha256 = remotefiles.github_archive(" + "project = 'google/copybara'," + "revision='674ac754f91e64a0efb8087e59a176484bd534d1').sha256()"));
assertThat(e).hasCauseThat().hasCauseThat().hasCauseThat().isInstanceOf(RepoException.class);
}
use of com.google.copybara.util.console.testing.TestingConsole in project copybara by google.
the class SkylarkTestExecutorTest method setup.
@Before
public void setup() {
TestingConsole console = new TestingConsole();
OptionsBuilder options = new OptionsBuilder();
options.setConsole(console);
skylark = new SkylarkTestExecutor(options).withStaticModules(ImmutableSet.of(DummyModule.class));
}
use of com.google.copybara.util.console.testing.TestingConsole in project copybara by google.
the class CoreTest method setup.
@Before
public void setup() {
console = new TestingConsole();
options = new OptionsBuilder();
options.setConsole(console);
skylark = new SkylarkTestExecutor(options);
}
Aggregations