github.com/ddnomad/packer@v1.3.2/packer/post_processor_mock.go (about) 1 package packer 2 3 // MockPostProcessor is an implementation of PostProcessor that can be 4 // used for tests. 5 type MockPostProcessor struct { 6 ArtifactId string 7 Keep bool 8 Error error 9 10 ConfigureCalled bool 11 ConfigureConfigs []interface{} 12 ConfigureError error 13 14 PostProcessCalled bool 15 PostProcessArtifact Artifact 16 PostProcessUi Ui 17 } 18 19 func (t *MockPostProcessor) Configure(configs ...interface{}) error { 20 t.ConfigureCalled = true 21 t.ConfigureConfigs = configs 22 return t.ConfigureError 23 } 24 25 func (t *MockPostProcessor) PostProcess(ui Ui, a Artifact) (Artifact, bool, error) { 26 t.PostProcessCalled = true 27 t.PostProcessArtifact = a 28 t.PostProcessUi = ui 29 30 return &MockArtifact{ 31 IdValue: t.ArtifactId, 32 }, t.Keep, t.Error 33 }