示例#1
0
文件: logs_test.go 项目: nttlabs/cli
	testconfig "github.com/nttlabs/cli/testhelpers/configuration"
	testlogs "github.com/nttlabs/cli/testhelpers/logs"
	testreq "github.com/nttlabs/cli/testhelpers/requirements"
	testterm "github.com/nttlabs/cli/testhelpers/terminal"

	. "github.com/nttlabs/cli/cf/commands/application"
	"github.com/nttlabs/cli/cf/configuration/core_config"
	. "github.com/nttlabs/cli/testhelpers/matchers"
	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
)

var _ = Describe("logs command", func() {
	var (
		ui                  *testterm.FakeUI
		logsRepo            *testapi.FakeLogsRepository
		requirementsFactory *testreq.FakeReqFactory
		configRepo          core_config.ReadWriter
	)

	BeforeEach(func() {
		ui = &testterm.FakeUI{}
		configRepo = testconfig.NewRepositoryWithDefaults()
		logsRepo = &testapi.FakeLogsRepository{}
		requirementsFactory = &testreq.FakeReqFactory{}
	})

	runCommand := func(args ...string) {
		testcmd.RunCommand(NewLogs(ui, configRepo, logsRepo), args, requirementsFactory)
	}

	Describe("requirements", func() {
示例#2
0
文件: start_test.go 项目: nttlabs/cli
	testconfig "github.com/nttlabs/cli/testhelpers/configuration"
	testlogs "github.com/nttlabs/cli/testhelpers/logs"
	testreq "github.com/nttlabs/cli/testhelpers/requirements"
	testterm "github.com/nttlabs/cli/testhelpers/terminal"
	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"

	. "github.com/nttlabs/cli/testhelpers/matchers"
)

var _ = Describe("start command", func() {
	var (
		ui                        *testterm.FakeUI
		defaultAppForStart        = models.Application{}
		defaultInstanceResponses  = [][]models.AppInstanceFields{}
		defaultInstanceErrorCodes = []string{"", ""}
		requirementsFactory       *testreq.FakeReqFactory
		logsForTail               []*logmessage.LogMessage
		logRepo                   *testapi.FakeLogsRepository
	)

	getInstance := func(appGuid string) (instances []models.AppInstanceFields, apiErr error) {
		if len(defaultInstanceResponses) > 0 {
			instances = defaultInstanceResponses[0]
			if len(defaultInstanceResponses) > 1 {
				defaultInstanceResponses = defaultInstanceResponses[1:]
			}
		}
		if len(defaultInstanceErrorCodes) > 0 {
			errorCode := defaultInstanceErrorCodes[0]
			if len(defaultInstanceErrorCodes) > 1 {