session.Wait() Ω(rpcHandlers.GetAppCallCount()).To(Equal(2)) }) It("sets deigo flag with /v2/apps endpoint", func() { rpcHandlers.GetAppStub = func(_ string, retVal *plugin_models.GetAppModel) error { *retVal = plugin_models.GetAppModel{Guid: "test-app-guid"} return nil } session, err := gexec.Start(exec.Command(validPluginPath, args...), GinkgoWriter, GinkgoWriter) Expect(err).NotTo(HaveOccurred()) session.Wait() Ω(rpcHandlers.CallCoreCommandCallCount()).To(Equal(1)) output, _ := rpcHandlers.CallCoreCommandArgsForCall(0) Ω(output[1]).To(ContainSubstring("v2/apps/test-app-guid")) Ω(output[5]).To(ContainSubstring(`"diego":true`)) }) It("exits with error when GetApp() returns error", func() { rpcHandlers.GetAppStub = func(_ string, retVal *plugin_models.GetAppModel) error { *retVal = plugin_models.GetAppModel{Guid: "test-app-guid"} return errors.New("error in GetApp") } session, err := gexec.Start(exec.Command(validPluginPath, args...), GinkgoWriter, GinkgoWriter) Expect(err).NotTo(HaveOccurred())