github.com/mook-as/cf-cli@v7.0.0-beta.28.0.20200120190804-b91c115fae48+incompatible/command/v6/create_service_auth_token_command_test.go (about)

     1  package v6_test
     2  
     3  import (
     4  	"code.cloudfoundry.org/cli/command/translatableerror"
     5  	. "code.cloudfoundry.org/cli/command/v6"
     6  	"code.cloudfoundry.org/cli/util/ui"
     7  	. "github.com/onsi/ginkgo"
     8  	. "github.com/onsi/gomega"
     9  	. "github.com/onsi/gomega/gbytes"
    10  )
    11  
    12  var _ = Describe("Create Service Auth Token", func() {
    13  	var (
    14  		cmd    CreateServiceAuthTokenCommand
    15  		testUI *ui.UI
    16  	)
    17  
    18  	BeforeEach(func() {
    19  		testUI = ui.NewTestUI(nil, NewBuffer(), NewBuffer())
    20  
    21  		cmd = CreateServiceAuthTokenCommand{
    22  			UI: testUI,
    23  		}
    24  	})
    25  
    26  	When("command is called in v6", func() {
    27  		It("returns an unrefactored command error", func() {
    28  			err := cmd.Execute(nil)
    29  			Expect(err).To(MatchError(translatableerror.UnrefactoredCommandError{}))
    30  		})
    31  
    32  		It("displays a deprecation warning", func() {
    33  			_ = cmd.Execute(nil)
    34  			Expect(testUI.Err).To(Say("Deprecation warning: This command has been deprecated. This feature will be removed in the future."))
    35  		})
    36  	})
    37  })