Search in sources :

Example 11 with DummyChecker

use of com.google.copybara.testing.DummyChecker in project copybara by google.

the class GitHubDestinationTest method setup.

@Before
public void setup() throws Exception {
    console = new TestingConsole();
    options = new OptionsBuilder().setConsole(console).setOutputRootToTmpDir();
    options.testingOptions.checker = new DummyChecker(ImmutableSet.of("bad_word"));
    workdir = Files.createTempDirectory("workdir");
    destinationFiles = Glob.createGlob(ImmutableList.of("**"));
    gitUtil = new GitTestUtil(options);
    gitUtil.mockRemoteGitRepos(new CompleteRefValidator());
    remote = gitUtil.mockRemoteRepo("github.com/foo");
    primaryBranch = remote.getPrimaryBranch();
    Path credentialsFile = Files.createTempFile("credentials", "test");
    Files.write(credentialsFile, "https://user:SECRET@github.com".getBytes(UTF_8));
    options.git.credentialHelperStorePath = credentialsFile.toString();
    options.gitDestination = new GitDestinationOptions(options.general, options.git);
    options.gitDestination.committerEmail = "commiter@email";
    options.gitDestination.committerName = "Bara Kopi";
    url = "https://github.com/foo";
    force = false;
    fetch = primaryBranch;
    push = primaryBranch;
    skylark = new SkylarkTestExecutor(options);
}
Also used : Path(java.nio.file.Path) TestingConsole(com.google.copybara.util.console.testing.TestingConsole) GitTestUtil(com.google.copybara.testing.git.GitTestUtil) OptionsBuilder(com.google.copybara.testing.OptionsBuilder) DummyChecker(com.google.copybara.testing.DummyChecker) CompleteRefValidator(com.google.copybara.testing.git.GitTestUtil.CompleteRefValidator) SkylarkTestExecutor(com.google.copybara.testing.SkylarkTestExecutor) Before(org.junit.Before)

Aggregations

DummyChecker (com.google.copybara.testing.DummyChecker)11 Test (org.junit.Test)6 OptionsBuilder (com.google.copybara.testing.OptionsBuilder)5 SkylarkTestExecutor (com.google.copybara.testing.SkylarkTestExecutor)5 TestingConsole (com.google.copybara.util.console.testing.TestingConsole)5 Before (org.junit.Before)5 Author (com.google.copybara.authoring.Author)3 CheckerException (com.google.copybara.checks.CheckerException)3 DummyRevision (com.google.copybara.testing.DummyRevision)3 GitTestUtil (com.google.copybara.testing.git.GitTestUtil)3 Path (java.nio.file.Path)3 WriterContext (com.google.copybara.WriterContext)2 GitLogEntry (com.google.copybara.git.GitRepository.GitLogEntry)2 DummyTrigger (com.google.copybara.testing.DummyTrigger)2 Change (com.google.copybara.Change)1 Changes (com.google.copybara.Changes)1 DestinationEffect (com.google.copybara.DestinationEffect)1 TransformResult (com.google.copybara.TransformResult)1 CompleteRefValidator (com.google.copybara.testing.git.GitTestUtil.CompleteRefValidator)1 Validator (com.google.copybara.testing.git.GitTestUtil.Validator)1