Ejemplo n.º 1
0
		af                app.AppFactory
	)

	BeforeEach(func() {
		fakeCliConnection = &fakes.FakeCliConnection{}
	})

	JustBeforeEach(func() {
		af = app.NewAppFactory(fakeCliConnection, curler)
	})

	Describe("Get", func() {
		Context("when CC returns a valid app guid", func() {
			BeforeEach(func() {
				fakeCliConnection.CliCommandWithoutTerminalOutputStub = func(args ...string) ([]string, error) {
					Expect(args).To(ConsistOf("app", "app1", "--guid"))
					return []string{"app1-guid\n"}, nil
				}
			})

			Context("when an App is returned", func() {
				BeforeEach(func() {
					curler = func(cli plugin.CliConnection, result interface{}, args ...string) error {
						a, ok := result.(*app.CFApp)
						Expect(ok).To(BeTrue())
						a.Metadata.Guid = "app1-guid"
						a.Entity.EnableSSH = true
						a.Entity.Diego = true
						a.Entity.State = "STARTED"
						return nil
					}
				})