Skip to content

Commit

Permalink
Merge pull request #821 from SoftLayer/issues783
Browse files Browse the repository at this point in the history
Removed --details from 'globalip unassign' as it did nothing
  • Loading branch information
CHRISTOPHER GALLO authored and GitHub Enterprise committed Dec 1, 2023
2 parents bdb5b06 + 545da52 commit 3c9c75e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
2 changes: 0 additions & 2 deletions plugin/commands/globalip/unassign.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ type UnassignCommand struct {
*metadata.SoftlayerCommand
NetworkManager managers.NetworkManager
Command *cobra.Command
Details bool
}

func NewUnassignCommand(sl *metadata.SoftlayerCommand) *UnassignCommand {
Expand All @@ -29,7 +28,6 @@ func NewUnassignCommand(sl *metadata.SoftlayerCommand) *UnassignCommand {
return thisCmd.Run(args)
},
}
cobraCmd.Flags().BoolVar(&thisCmd.Details, "details", false, T("Shows a very detailed list of charges"))
thisCmd.Command = cobraCmd
return thisCmd
}
Expand Down
14 changes: 6 additions & 8 deletions plugin/commands/globalip/unassign_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@ package globalip_test

import (
"errors"
"strings"

. "github.com/IBM-Cloud/ibm-cloud-cli-sdk/testhelpers/matchers"
"github.com/IBM-Cloud/ibm-cloud-cli-sdk/testhelpers/terminal"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
Expand Down Expand Up @@ -37,14 +35,14 @@ var _ = Describe("GlobalIP unassign", func() {
It("return error", func() {
err := testhelpers.RunCobraCommand(cliCommand.Command)
Expect(err).To(HaveOccurred())
Expect(strings.Contains(err.Error(), "Incorrect Usage: This command requires one argument")).To(BeTrue())
Expect(err.Error()).To(ContainSubstring("Incorrect Usage: This command requires one argument"))
})
})
Context("GlobalIP unassign with wrong IP ID", func() {
It("return error", func() {
err := testhelpers.RunCobraCommand(cliCommand.Command, "abc")
Expect(err).To(HaveOccurred())
Expect(strings.Contains(err.Error(), "Invalid input for 'Globalip ID'. It must be a positive integer.")).To(BeTrue())
Expect(err.Error()).To(ContainSubstring("Invalid input for 'Globalip ID'. It must be a positive integer."))
})
})

Expand All @@ -55,8 +53,8 @@ var _ = Describe("GlobalIP unassign", func() {
It("return error", func() {
err := testhelpers.RunCobraCommand(cliCommand.Command, "1234")
Expect(err).To(HaveOccurred())
Expect(strings.Contains(err.Error(), "Failed to unassign global IP 1234.")).To(BeTrue())
Expect(strings.Contains(err.Error(), "Internal Server Error")).To(BeTrue())
Expect(err.Error()).To(ContainSubstring("Failed to unassign global IP 1234."))
Expect(err.Error()).To(ContainSubstring("Internal Server Error"))
})
})

Expand All @@ -67,8 +65,8 @@ var _ = Describe("GlobalIP unassign", func() {
It("return no error", func() {
err := testhelpers.RunCobraCommand(cliCommand.Command, "1234")
Expect(err).NotTo(HaveOccurred())
Expect(fakeUI.Outputs()).To(ContainSubstrings([]string{"OK"}))
Expect(fakeUI.Outputs()).To(ContainSubstrings([]string{"The transaction to unroute a global IP address is created, routes will be updated in one or two minutes."}))
Expect(fakeUI.Outputs()).To(ContainSubstring("OK"))
Expect(fakeUI.Outputs()).To(ContainSubstring("The transaction to unroute a global IP address is created, routes will be updated in one or two minutes."))
})
})
})
Expand Down

0 comments on commit 3c9c75e

Please sign in to comment.