application = models.Application{}
			application.Name = "app-name"
		})

		JustBeforeEach(func() {
			runCLIErr = cmd.Execute(flagContext)
		})

		AfterEach(func() {
			os.Remove("app-name_manifest.yml")
		})

		Context("when there is an app summary", func() {
			BeforeEach(func() {
				appSummaryRepo.GetSummaryReturns(application, nil)
			})

			It("tries to get the app summary", func() {
				Expect(runCLIErr).NotTo(HaveOccurred())
				Expect(appSummaryRepo.GetSummaryCallCount()).To(Equal(1))
			})
		})

		Context("when there is an error getting the app summary", func() {
			BeforeEach(func() {
				appSummaryRepo.GetSummaryReturns(models.Application{}, errors.New("get-summary-err"))
			})

			It("prints an error", func() {
				Expect(runCLIErr).To(HaveOccurred())
Beispiel #2
0
			appInstanceFields = []models.AppInstanceFields{
				{
					State:     models.InstanceRunning,
					Details:   "fake-instance-details",
					Since:     time.Date(2015, time.November, 19, 1, 1, 17, 0, time.UTC),
					CPUUsage:  float64(0.25),
					DiskUsage: int64(1 * formatters.GIGABYTE),
					DiskQuota: int64(2 * formatters.GIGABYTE),
					MemUsage:  int64(24 * formatters.MEGABYTE),
					MemQuota:  int64(32 * formatters.MEGABYTE),
				},
			}

			applicationRequirement.GetApplicationReturns(getApplicationModel)
			appSummaryRepo.GetSummaryReturns(getAppSummaryModel, getAppSummaryErr)
			appInstancesRepo.GetInstancesReturns(appInstanceFields, nil)
		})

		JustBeforeEach(func() {
			err = cmd.Execute(flagContext)
		})

		It("gets the application summary", func() {
			Expect(err).NotTo(HaveOccurred())
			Expect(appSummaryRepo.GetSummaryCallCount()).To(Equal(1))
		})

		It("gets the app instances", func() {
			Expect(err).NotTo(HaveOccurred())
			Expect(appInstancesRepo.GetInstancesCallCount()).To(Equal(1))