Ejemplo n.º 1
0
			BeforeEach(func() {
				args = []string{ts.Port(), "enable-diego", "test-app"}
			})

			It("needs APP_NAME as argument", func() {
				args = []string{ts.Port(), "enable-diego"}
				session, err := gexec.Start(exec.Command(validPluginPath, args...), GinkgoWriter, GinkgoWriter)
				Expect(err).NotTo(HaveOccurred())

				session.Wait()
				Ω(session).To(gbytes.Say("Invalid Usage"))
			})

			It("calls GetApp() twice, one to get app guid, another to verify flag is set", func() {
				rpcHandlers.GetAppStub = func(_ string, retVal *plugin_models.GetAppModel) error {
					*retVal = plugin_models.GetAppModel{}
					return nil
				}

				session, err := gexec.Start(exec.Command(validPluginPath, args...), GinkgoWriter, GinkgoWriter)
				Expect(err).NotTo(HaveOccurred())

				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
				}