@@ -6,10 +6,10 @@ import (
66 "github.com/UpCloudLtd/upcloud-cli/internal/commands"
77 "github.com/UpCloudLtd/upcloud-cli/internal/config"
88 smock "github.com/UpCloudLtd/upcloud-cli/internal/mock"
9+ "github.com/UpCloudLtd/upcloud-cli/internal/mockexecute"
910
1011 "github.com/UpCloudLtd/upcloud-go-api/v4/upcloud"
1112 "github.com/UpCloudLtd/upcloud-go-api/v4/upcloud/request"
12- "github.com/gemalto/flume"
1313 "github.com/stretchr/testify/assert"
1414 "github.com/stretchr/testify/mock"
1515)
@@ -40,7 +40,7 @@ func TestCreateFirewallRuleCommand(t *testing.T) {
4040 name : "Empty info" ,
4141 flags : []string {},
4242 arg : Server1 .UUID ,
43- error : "direction is required" ,
43+ error : `required flag(s) "direction", "action" not set` ,
4444 },
4545 {
4646 name : "Action is required" ,
@@ -49,7 +49,7 @@ func TestCreateFirewallRuleCommand(t *testing.T) {
4949 "--direction" , "in" ,
5050 },
5151 arg : Server1 .UUID ,
52- error : "action is required" ,
52+ error : `required flag(s) "action" not set` ,
5353 },
5454 {
5555 name : "FirewallRule, drop incoming by default" ,
@@ -96,10 +96,10 @@ func TestCreateFirewallRuleCommand(t *testing.T) {
9696
9797 conf := config .New ()
9898 cc := commands .BuildCommand (CreateCommand (), nil , conf )
99- err := cc .Cobra ().Flags ().Parse (test .flags )
100- assert .NoError (t , err )
10199
102- _ , err = cc .(commands.MultipleArgumentCommand ).Execute (commands .NewExecutor (conf , & mService , flume .New ("test" )), test .arg )
100+ cc .Cobra ().SetArgs (append (test .flags , test .arg ))
101+ _ , err := mockexecute .MockExecute (cc , & mService , conf )
102+
103103 if test .error != "" {
104104 assert .Error (t , err )
105105 assert .Equal (t , test .error , err .Error ())
0 commit comments