示例#1
0
		authRepo = &testapi.FakeAuthenticationRepository{}
		appRepo = &testApplication.FakeApplicationRepository{}
		copyAppSourceRepo = &testCopyApplication.FakeCopyApplicationSourceRepository{}
		spaceRepo = &testapi.FakeSpaceRepository{}
		orgRepo = &testorg.FakeOrganizationRepository{}
		config = testconfig.NewRepositoryWithDefaults()

		//save original command and restore later
		OriginalCommand = command_registry.Commands.FindCommand("restart")

		appRestarter = &testcmd.FakeApplicationRestarter{}
		//setup fakes to correctly interact with command_registry
		appRestarter.SetDependencyStub = func(_ command_registry.Dependency, _ bool) command_registry.Command {
			return appRestarter
		}
		appRestarter.MetaDataReturns(command_registry.CommandMetadata{Name: "restart"})
	})

	AfterEach(func() {
		command_registry.Register(OriginalCommand)
	})

	runCommand := func(args ...string) bool {
		return testcmd.RunCliCommand("copy-source", args, requirementsFactory, updateCommandDependency, false)
	}

	Describe("requirement failures", func() {
		It("when not logged in", func() {
			requirementsFactory.LoginSuccess = false
			Expect(runCommand("source-app", "target-app")).ToNot(HavePassedRequirements())
		})