66
77 "github.com/stackitcloud/stackit-cli/internal/pkg/globalflags"
88 "github.com/stackitcloud/stackit-cli/internal/pkg/print"
9- "github.com/stackitcloud/stackit-cli/internal/pkg/utils"
109
1110 "github.com/google/go-cmp/cmp"
1211 "github.com/google/go-cmp/cmp/cmpopts"
@@ -34,7 +33,6 @@ func fixtureFlagValues(mods ...func(flagValues map[string]string)) map[string]st
3433 globalflags .RegionFlag : testRegion ,
3534 usernameFlag : testUsername ,
3635 displaynameFlag : testDisplayname ,
37- passwordFlag : "true" ,
3836 }
3937 for _ , mod := range mods {
4038 mod (flagValues )
@@ -52,7 +50,6 @@ func fixtureInputModel(mods ...func(model *inputModel)) inputModel {
5250 Username : & testUsername ,
5351 Displayname : & testDisplayname ,
5452 CredentialsRef : & testCredentialRef ,
55- Password : utils .Ptr (true ),
5653 }
5754 for _ , mod := range mods {
5855 mod (& model )
@@ -103,52 +100,23 @@ func TestParseInput(t *testing.T) {
103100 globalflags .ProjectIdFlag : testProjectId ,
104101 globalflags .RegionFlag : testRegion ,
105102 },
106- isValid : true ,
103+ isValid : false ,
107104 expectedModel : fixtureInputModel (func (model * inputModel ) {
108105 model .Username = nil
109- model .Password = nil
110106 model .Displayname = nil
111107 }),
112108 },
113109 {
110+ description : "required values" ,
114111 args : []string {testCredentialRef },
115- description : "only username" ,
116112 flagValues : map [string ]string {
117113 globalflags .ProjectIdFlag : testProjectId ,
118114 globalflags .RegionFlag : testRegion ,
119115 usernameFlag : testUsername ,
120- },
121- expectedModel : fixtureInputModel (func (model * inputModel ) {
122- model .Displayname = nil
123- model .Password = nil
124- }),
125- isValid : true ,
126- }, {
127- description : "only displayname" ,
128- args : []string {testCredentialRef },
129- flagValues : map [string ]string {
130- globalflags .ProjectIdFlag : testProjectId ,
131- globalflags .RegionFlag : testRegion ,
132116 displaynameFlag : testDisplayname ,
133117 },
134- expectedModel : fixtureInputModel (func (model * inputModel ) {
135- model .Username = nil
136- model .Password = nil
137- }),
138- isValid : true ,
139- }, {
140- description : "only password" ,
141- args : []string {testCredentialRef },
142- flagValues : map [string ]string {
143- globalflags .ProjectIdFlag : testProjectId ,
144- globalflags .RegionFlag : testRegion ,
145- passwordFlag : "true" ,
146- },
147- expectedModel : fixtureInputModel (func (model * inputModel ) {
148- model .Username = nil
149- model .Displayname = nil
150- }),
151- isValid : true ,
118+ isValid : true ,
119+ expectedModel : fixtureInputModel (),
152120 },
153121 }
154122
0 commit comments