use of com.google.copybara.testing.RecordsProcessCallDestination.ProcessedChange in project copybara by google.
the class MetadataModuleTest method testsSaveAuthor.
@Test
public void testsSaveAuthor() throws Exception {
Workflow<?, ?> wf = createWorkflow(WorkflowMode.ITERATIVE, "metadata.save_author()");
origin.setAuthor(new Author("keep me", "keep@me.com")).addSimpleChange(0, "A change");
wf.run(workdir, ImmutableList.of());
ProcessedChange change = Iterables.getLast(destination.processed);
assertThat(change.getChangesSummary()).contains("ORIGINAL_AUTHOR=keep me <keep@me.com>");
}
use of com.google.copybara.testing.RecordsProcessCallDestination.ProcessedChange in project copybara by google.
the class MetadataModuleTest method testAddHeader_noNewLine.
@Test
public void testAddHeader_noNewLine() throws Exception {
options.setLastRevision(origin.resolve("HEAD").asString());
Workflow<?, ?> wf = createWorkflow(WorkflowMode.ITERATIVE, "metadata.add_header('[HEADER with ${LABEL}]: ', new_line = False)");
origin.addSimpleChange(0, "" + "A change\n" + "\n" + "LABEL=some label\n");
wf.run(workdir, ImmutableList.of());
ProcessedChange change = Iterables.getLast(destination.processed);
assertThat(change.getChangesSummary()).isEqualTo("" + "[HEADER with some label]: A change\n" + "\n" + "LABEL=some label\n");
}
use of com.google.copybara.testing.RecordsProcessCallDestination.ProcessedChange in project copybara by google.
the class MetadataModuleTest method testUseLastChange.
@Test
public void testUseLastChange() throws Exception {
runWorkflow(WorkflowMode.SQUASH, "metadata.use_last_change()");
ProcessedChange change = Iterables.getOnlyElement(destination.processed);
assertThat(change.getChangesSummary()).isEqualTo("" + "third commit\n" + "\n" + "Extended text");
assertThat(change.getAuthor()).isEqualTo(FOO_BAZ);
}
use of com.google.copybara.testing.RecordsProcessCallDestination.ProcessedChange in project copybara by google.
the class MetadataModuleTest method testUseLastChange_noMessage.
@Test
public void testUseLastChange_noMessage() throws Exception {
runWorkflow(WorkflowMode.SQUASH, "metadata.use_last_change(message=False)");
ProcessedChange change = Iterables.getOnlyElement(destination.processed);
assertThat(change.getChangesSummary()).isEqualTo("Project import generated by Copybara.\n");
assertThat(change.getAuthor()).isEqualTo(FOO_BAZ);
}
Aggregations