Skip to content

Commit

Permalink
refactor: change string message to a string variable containing the m…
Browse files Browse the repository at this point in the history
…essage
  • Loading branch information
gabriel-azion committed Feb 27, 2023
1 parent ae2f94a commit 658c1ad
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion pkg/cmd/edge_services/create/create_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"github.com/aziontech/azion-cli/pkg/testutils"
sdk "github.com/aziontech/azionapi-go-sdk/edgeservices"
"github.com/stretchr/testify/require"
msg "github.com/aziontech/azion-cli/messages/edge_services"
)

var responseBody = `
Expand Down Expand Up @@ -60,7 +61,7 @@ func TestCreate(t *testing.T) {
cmd.SetErr(io.Discard)

_, err := cmd.ExecuteC()
require.EqualError(t, err, "A mandatory flag is missing. You must provide --name flag when --in flag is not sent. Run the command 'azioncli edge_services <subcommand> --help' to display more information and try again")
require.ErrorIs(t, err, msg.ErrorMandatoryName)
})

t.Run("create service with name", func(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion pkg/cmd/edge_services/resources/create/create_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ func TestCreate(t *testing.T) {
cmd.SetErr(io.Discard)

_, err := cmd.ExecuteC()
require.EqualError(t, err, "A mandatory flag is missing. You must provide --name, --content-type, and --content-file flags when the --in flag is not sent. Run the command 'azioncli edge_services <subcommand> --help' to display more information and try again")
require.ErrorIs(t, err, errmsg.ErrorMandatoryFlagsResource)
})

t.Run("content file cannot be empty", func(t *testing.T) {
Expand Down

0 comments on commit 658c1ad

Please sign in to comment.