Skip to content

Commit 730d870

Browse files
committed
Create application command
1 parent 362f730 commit 730d870

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

application/commands/application/create_app_cmd_test.go

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ package application
22

33
import (
44
"errors"
5+
"flag"
6+
"github.com/urfave/cli"
57
"testing"
68

79
"github.com/jfrog/jfrog-cli-application/application/model"
@@ -64,17 +66,20 @@ func TestCreateAppCommand_Error(t *testing.T) {
6466
func TestCreateAppCommand_WrongNumberOfArguments(t *testing.T) {
6567
ctrl := gomock.NewController(t)
6668
defer ctrl.Finish()
69+
app := cli.NewApp()
70+
set := flag.NewFlagSet("test", 0)
71+
ctx := cli.NewContext(app, set, nil)
6772

6873
mockAppService := mockapps.NewMockApplicationService(ctrl)
6974
cmd := &createAppCommand{
7075
applicationService: mockAppService,
7176
}
7277

7378
// Test with no arguments
74-
ctx := &components.Context{
75-
Arguments: []string{},
76-
}
77-
err := cmd.prepareAndRunCommand(ctx)
79+
context, err := components.ConvertContext(ctx)
80+
assert.NoError(t, err)
81+
82+
err = cmd.prepareAndRunCommand(context)
7883
assert.Error(t, err)
79-
assert.Contains(t, err.Error(), "exactly one application key is required")
84+
assert.Contains(t, err.Error(), "Wrong number of arguments")
8085
}

0 commit comments

Comments
 (0)