예제 #1
0
파일: ssh_test.go 프로젝트: vframbach/cli
		sshCodeGetter         *cmdFakes.FakeSSHCodeGetter
		originalSSHCodeGetter command_registry.Command

		requirementsFactory *testreq.FakeReqFactory
		configRepo          core_config.Repository
		deps                command_registry.Dependency
		ccGateway           net.Gateway

		fakeSecureShell *testssh.FakeSecureShell
	)

	BeforeEach(func() {
		ui = &testterm.FakeUI{}
		configRepo = testconfig.NewRepositoryWithDefaults()
		requirementsFactory = &testreq.FakeReqFactory{}
		deps.Gateways = make(map[string]net.Gateway)

		//save original command and restore later
		originalSSHCodeGetter = command_registry.Commands.FindCommand("ssh-code")

		sshCodeGetter = &cmdFakes.FakeSSHCodeGetter{}

		//setup fakes to correctly interact with command_registry
		sshCodeGetter.SetDependencyStub = func(_ command_registry.Dependency, _ bool) command_registry.Command {
			return sshCodeGetter
		}
		sshCodeGetter.MetaDataReturns(command_registry.CommandMetadata{Name: "ssh-code"})
	})

	AfterEach(func() {
		//restore original command