func NewFakeUpdateStateCommand(options cmds.Options, bmpClient clients.BmpClient, userInput string) updateStateCommand { FakeUi := fakes.NewFakeUi() FakeUi.UserInput = userInput return updateStateCommand{ options: options, ui: FakeUi, printer: common.NewDefaultPrinter(FakeUi, options.Verbose), bmpClient: bmpClient, } }
func NewFakeProvisioningBaremetalCommand(options cmds.Options, bmpClient clients.BmpClient, userInput string) provisioningBaremetalCommand { FakeUi := fakes.NewFakeUi() FakeUi.UserInput = userInput return provisioningBaremetalCommand{ options: options, ui: FakeUi, printer: common.NewDefaultPrinter(FakeUi, options.Verbose), bmpClient: bmpClient, } }
. "github.com/onsi/ginkgo" . "github.com/onsi/gomega" common "github.com/cloudfoundry-community/bosh-softlayer-tools/common" fakes "github.com/cloudfoundry-community/bosh-softlayer-tools/common/fakes" ) var _ = Describe("DefaultPrinter", func() { var ( printer common.Printer fakeUi *fakes.FakeUi ) BeforeEach(func() { fakeUi = fakes.NewFakeUi() }) Describe("when verbose is true", func() { BeforeEach(func() { printer = common.NewDefaultPrinter(fakeUi, true) }) It("#Printf", func() { rc, err := printer.Printf("%s %s", "hello", "world") Expect(rc).To(Equal(0)) Expect(err).ToNot(HaveOccurred()) Expect(fakeUi.Output).To(ContainSubstring(fmt.Sprintf("%s %s", "hello", "world"))) })