Beispiel #1
0
package cmd_test

import (
	"bytes"
	"errors"

	"github.com/cloudfoundry-incubator/diego-ssh/cf-plugin/cmd"
	"github.com/cloudfoundry-incubator/diego-ssh/cf-plugin/models/space"
	"github.com/cloudfoundry-incubator/diego-ssh/cf-plugin/models/space/space_fakes"

	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
)

var _ = Describe("SSHAllowed", func() {
	var fakeSpaceFactory *space_fakes.FakeSpaceFactory
	var mySpace space.Space

	BeforeEach(func() {
		fakeSpaceFactory = &space_fakes.FakeSpaceFactory{}
		mySpace = space.Space{Guid: "myguid"}
	})

	Context("validation", func() {
		It("requires an spacelication name", func() {
			err := cmd.SSHAllowed([]string{"space-ssh-allowed"}, fakeSpaceFactory, nil)

			Expect(err).To(MatchError("Invalid usage\n" + cmd.SSHAllowedUsage))
		})

		It("validates the command name", func() {
Beispiel #2
0
package cmd_test

import (
	"errors"

	"github.com/cloudfoundry-incubator/diego-ssh/cf-plugin/cmd"
	"github.com/cloudfoundry-incubator/diego-ssh/cf-plugin/models/space"
	"github.com/cloudfoundry-incubator/diego-ssh/cf-plugin/models/space/space_fakes"

	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
)

var _ = Describe("AllowSSH", func() {
	var fakeSpaceFactory *space_fakes.FakeSpaceFactory
	var mySpace space.Space

	BeforeEach(func() {
		fakeSpaceFactory = &space_fakes.FakeSpaceFactory{}
		mySpace = space.Space{Guid: "myguid"}
	})

	Context("validation", func() {
		It("requires an space name", func() {
			err := cmd.AllowSSH([]string{"allow-space-ssh"}, fakeSpaceFactory)

			Expect(err).To(MatchError("Invalid usage\n" + cmd.AllowSSHUsage))
		})

		It("validates the command name", func() {
			err := cmd.AllowSSH([]string{"bogus", "space"}, fakeSpaceFactory)