当前位置: 首页>>代码示例>>Golang>>正文


Golang FakeApplicationRepository.UpdateReturns方法代码示例

本文整理汇总了Golang中github.com/cloudfoundry/cli/cf/api/applications/applicationsfakes.FakeApplicationRepository.UpdateReturns方法的典型用法代码示例。如果您正苦于以下问题:Golang FakeApplicationRepository.UpdateReturns方法的具体用法?Golang FakeApplicationRepository.UpdateReturns怎么用?Golang FakeApplicationRepository.UpdateReturns使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在github.com/cloudfoundry/cli/cf/api/applications/applicationsfakes.FakeApplicationRepository的用法示例。


在下文中一共展示了FakeApplicationRepository.UpdateReturns方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1:

					"MY_VAR",
					"--has-a-cool-value",
				},
				[]string{"OK"},
				[]string{"TIP"},
			))
			_, params := appRepo.UpdateArgsForCall(0)
			Expect(*params.EnvironmentVars).To(Equal(map[string]interface{}{
				"MY_VAR": "--has-a-cool-value",
				"foo":    "bar",
			}))
		})

		Context("when setting fails", func() {
			BeforeEach(func() {
				appRepo.UpdateReturns(models.Application{}, errors.New("Error updating app."))
			})

			It("tells the user", func() {
				runCommand("please", "dont", "fail")

				Expect(ui.Outputs).To(ContainSubstrings(
					[]string{"Setting env variable"},
					[]string{"FAILED"},
					[]string{"Error updating app."},
				))
			})
		})
	})
})
开发者ID:yingkitw,项目名称:cli,代码行数:30,代码来源:set_env_test.go

示例2:

		logRepoWithTimeout := new(logsfakes.FakeLogsRepositoryWithTimeout)
		updateCommandDependency(logRepoWithTimeout)

		cmd := commandregistry.Commands.FindCommand("start").(*Start)
		cmd.LogServerConnectionTimeout = 100 * time.Millisecond
		cmd.StagingTimeout = 100 * time.Millisecond
		cmd.StartupTimeout = 200 * time.Millisecond
		cmd.PingerThrottle = 10 * time.Millisecond
		commandregistry.Register(cmd)

		testcmd.RunCLICommandWithoutDependency("start", args, requirementsFactory)
		return
	}

	startAppWithInstancesAndErrors := func(app models.Application, requirementsFactory *testreq.FakeReqFactory) (*testterm.FakeUI, *applicationsfakes.FakeApplicationRepository, *appinstancesfakes.FakeAppInstancesRepository) {
		appRepo.UpdateReturns(app, nil)
		appRepo.ReadReturns(app, nil)
		appRepo.GetAppReturns(app, nil)
		appInstancesRepo.GetInstancesStub = getInstance

		args := []string{"my-app"}

		requirementsFactory.Application = app
		callStart(args)
		return ui, appRepo, appInstancesRepo
	}

	It("fails requirements when not logged in", func() {
		requirementsFactory.LoginSuccess = false

		Expect(callStart([]string{"some-app-name"})).To(BeFalse())
开发者ID:yingkitw,项目名称:cli,代码行数:31,代码来源:start_test.go

示例3:

			requirementsFactory.LoginSuccess = true
			requirementsFactory.TargetedSpaceSuccess = true

			Expect(testcmd.RunCLICommand("scale", []string{"my-app"}, requirementsFactory, updateCommandDependency, false)).To(BeTrue())
		})
	})

	Describe("scaling an app", func() {
		BeforeEach(func() {
			app = maker.NewApp(maker.Overrides{"name": "my-app", "guid": "my-app-guid"})
			app.InstanceCount = 42
			app.DiskQuota = 1024
			app.Memory = 256

			requirementsFactory.Application = app
			appRepo.UpdateReturns(app, nil)
		})

		Context("when no flags are specified", func() {
			It("prints a description of the app's limits", func() {
				testcmd.RunCLICommand("scale", []string{"my-app"}, requirementsFactory, updateCommandDependency, false)

				Expect(ui.Outputs).To(ContainSubstrings(
					[]string{"Showing", "my-app", "my-org", "my-space", "my-user"},
					[]string{"OK"},
					[]string{"memory", "256M"},
					[]string{"disk", "1G"},
					[]string{"instances", "42"},
				))

				Expect(ui.Outputs).ToNot(ContainSubstrings([]string{"Scaling", "my-app", "my-org", "my-space", "my-user"}))
开发者ID:yingkitw,项目名称:cli,代码行数:31,代码来源:scale_test.go

示例4:

		It("stops the app with the given name", func() {
			runCommand("my-app")

			Expect(ui.Outputs).To(ContainSubstrings(
				[]string{"Stopping app", "my-app", "my-org", "my-space", "my-user"},
				[]string{"OK"},
			))

			Expect(requirementsFactory.ApplicationName).To(Equal("my-app"))
			appGUID, _ := appRepo.UpdateArgsForCall(0)
			Expect(appGUID).To(Equal("my-app-guid"))
		})

		It("warns the user when stopping the app fails", func() {
			appRepo.UpdateReturns(models.Application{}, errors.New("Error updating app."))
			runCommand("my-app")

			Expect(ui.Outputs).To(ContainSubstrings(
				[]string{"Stopping", "my-app"},
				[]string{"FAILED"},
				[]string{"Error updating app."},
			))
			appGUID, _ := appRepo.UpdateArgsForCall(0)
			Expect(appGUID).To(Equal("my-app-guid"))
		})

		Context("when the app is stopped", func() {
			BeforeEach(func() {
				app.State = "stopped"
			})
开发者ID:yingkitw,项目名称:cli,代码行数:30,代码来源:stop_test.go


注:本文中的github.com/cloudfoundry/cli/cf/api/applications/applicationsfakes.FakeApplicationRepository.UpdateReturns方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。