use of com.google.copybara.testing.RecordsProcessCallDestination.ProcessedChange in project copybara by google.
the class MetadataModuleTest method testMessageTransformerForNoDescription.
@Test
public void testMessageTransformerForNoDescription() throws Exception {
runWorkflow(WorkflowMode.SQUASH, "" + "metadata.squash_notes(" + " prefix = 'Importing foo project:\\n\\n'," + " show_description = False," + ")");
ProcessedChange change = Iterables.getOnlyElement(destination.processed);
assertThat(change.getChangesSummary()).isEqualTo("" + "Importing foo project:\n" + "\n" + " - 2 by Foo Baz <foo@baz.com>\n" + " - 1 by Foo Bar <foo@bar.com>\n");
assertThat(change.getAuthor()).isEqualTo(DEFAULT_AUTHOR);
}
use of com.google.copybara.testing.RecordsProcessCallDestination.ProcessedChange in project copybara by google.
the class MetadataModuleTest method testAddHeaderLabelNotFoundIgnore.
@Test
public void testAddHeaderLabelNotFoundIgnore() throws Exception {
options.setLastRevision(origin.resolve("HEAD").asString());
Workflow<?, ?> wf = createWorkflow(WorkflowMode.ITERATIVE, "metadata.add_header('[HEADER with ${LABEL}]', " + "ignore_label_not_found = True)");
origin.addSimpleChange(0, "A change\n");
wf.run(workdir, ImmutableList.of());
ProcessedChange change = Iterables.getLast(destination.processed);
assertThat(change.getChangesSummary()).isEqualTo("A change\n");
}
use of com.google.copybara.testing.RecordsProcessCallDestination.ProcessedChange in project copybara by google.
the class MetadataModuleTest method testMessageTransformerForSquashCompactNoRefOrAuthor.
@Test
public void testMessageTransformerForSquashCompactNoRefOrAuthor() throws Exception {
runWorkflow(WorkflowMode.SQUASH, "" + "metadata.squash_notes(" + " prefix = 'Importing foo project:\\n\\n'," + " oldest_first = True," + " show_ref = False," + " show_author = False," + ")");
ProcessedChange change = Iterables.getOnlyElement(destination.processed);
assertThat(change.getChangesSummary()).isEqualTo("" + "Importing foo project:\n" + "\n" + " - second commit\n" + " - third commit\n");
assertThat(change.getAuthor()).isEqualTo(DEFAULT_AUTHOR);
}
use of com.google.copybara.testing.RecordsProcessCallDestination.ProcessedChange in project copybara by google.
the class MetadataModuleTest method testMessageTransformerForSquashCompact.
@Test
public void testMessageTransformerForSquashCompact() throws Exception {
runWorkflow(WorkflowMode.SQUASH, "" + "metadata.map_author({" + " 'Foo Bar': 'Public Foo Bar <public@foobar.com>'," + " 'Foo Baz': 'Public Foo Baz <public@foobaz.com>'," + "})," + "metadata.squash_notes(" + " prefix = 'Importing foo project:\\n\\n'," + " oldest_first = True," + ")");
ProcessedChange change = Iterables.getOnlyElement(destination.processed);
assertThat(change.getChangesSummary()).isEqualTo("" + "Importing foo project:\n" + "\n" + " - 1 second commit by Foo Bar <foo@bar.com>\n" + " - 2 third commit by Foo Baz <foo@baz.com>\n");
assertThat(change.getAuthor()).isEqualTo(DEFAULT_AUTHOR);
}
use of com.google.copybara.testing.RecordsProcessCallDestination.ProcessedChange in project copybara by google.
the class MetadataModuleTest method testSquashWithMapAuthor.
@Test
public void testSquashWithMapAuthor() throws Exception {
runWorkflow(WorkflowMode.SQUASH, "" + "metadata.map_author({" + " 'Foo Bar': 'Public Foo Bar <public@foobar.com>'," + " 'Foo Baz': 'Public Foo Baz <public@foobaz.com>'," + "}," + " map_all_changes = True)," + "metadata.squash_notes(" + " prefix = 'Importing foo project:\\n\\n'," + " oldest_first = True," + ")");
ProcessedChange change = Iterables.getOnlyElement(destination.processed);
assertThat(change.getChangesSummary()).isEqualTo("" + "Importing foo project:\n" + "\n" + " - 1 second commit by Public Foo Bar <public@foobar.com>\n" + " - 2 third commit by Public Foo Baz <public@foobaz.com>\n");
assertThat(change.getAuthor()).isEqualTo(DEFAULT_AUTHOR);
}
Aggregations