Skip to content

Commit 6f99104

Browse files
committed
fix tests
1 parent 760b3e5 commit 6f99104

File tree

1 file changed

+8
-15
lines changed

1 file changed

+8
-15
lines changed

apptrust/commands/version/create_app_version_cmd_test.go

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,11 @@ func TestCreateAppVersionCommand(t *testing.T) {
4848
ctrl := gomock.NewController(t)
4949
defer ctrl.Finish()
5050

51-
serverDetails := &config.ServerDetails{
52-
Url: "https://example.com",
51+
ctx := &components.Context{
52+
Arguments: []string{"app-key", "1.0.0"},
5353
}
54+
ctx.AddStringFlag("url", "https://example.com")
55+
5456
mockVersionService := mockversions.NewMockVersionService(ctrl)
5557
if tt.shouldError {
5658
mockVersionService.EXPECT().CreateAppVersion(gomock.Any(), tt.request).
@@ -62,7 +64,7 @@ func TestCreateAppVersionCommand(t *testing.T) {
6264

6365
cmd := &createAppVersionCommand{
6466
versionService: mockVersionService,
65-
serverDetails: serverDetails,
67+
serverDetails: &config.ServerDetails{Url: "https://example.com"},
6668
requestPayload: tt.request,
6769
}
6870

@@ -87,15 +89,12 @@ func TestCreateAppVersionCommand_SpecAndFlags_Error(t *testing.T) {
8789
}
8890
ctx.AddStringFlag("spec", testSpecPath)
8991
ctx.AddStringFlag("package-name", "name")
92+
ctx.AddStringFlag("url", "https://example.com")
9093

91-
serverDetails := &config.ServerDetails{
92-
Url: "https://example.com",
93-
}
9494
mockVersionService := mockversions.NewMockVersionService(ctrl)
9595

9696
cmd := &createAppVersionCommand{
9797
versionService: mockVersionService,
98-
serverDetails: serverDetails,
9998
}
10099

101100
err := cmd.prepareAndRunCommand(ctx)
@@ -119,6 +118,7 @@ func TestCreateAppVersionCommand_FlagsSuite(t *testing.T) {
119118
ctx.AddStringFlag("package-name", "name")
120119
ctx.AddStringFlag("package-version", "1.0.0")
121120
ctx.AddStringFlag("package-repository", "repo")
121+
ctx.AddStringFlag("url", "https://example.com")
122122
},
123123
expectsPayload: &model.CreateAppVersionRequest{
124124
ApplicationKey: "app-key",
@@ -141,6 +141,7 @@ func TestCreateAppVersionCommand_FlagsSuite(t *testing.T) {
141141
ctx.AddStringFlag("package-name", "name")
142142
ctx.AddStringFlag("package-version", "1.0.0")
143143
ctx.AddStringFlag("package-repository", "repo")
144+
ctx.AddStringFlag("url", "https://example.com")
144145
},
145146
expectsPayload: &model.CreateAppVersionRequest{
146147
ApplicationKey: "app-key",
@@ -165,9 +166,6 @@ func TestCreateAppVersionCommand_FlagsSuite(t *testing.T) {
165166
ctx := &components.Context{}
166167
tt.ctxSetup(ctx)
167168

168-
serverDetails := &config.ServerDetails{
169-
Url: "https://example.com",
170-
}
171169
var actualPayload *model.CreateAppVersionRequest
172170
mockVersionService := mockversions.NewMockVersionService(ctrl)
173171
if !tt.expectsError {
@@ -180,7 +178,6 @@ func TestCreateAppVersionCommand_FlagsSuite(t *testing.T) {
180178

181179
cmd := &createAppVersionCommand{
182180
versionService: mockVersionService,
183-
serverDetails: serverDetails,
184181
}
185182

186183
err := cmd.prepareAndRunCommand(ctx)
@@ -335,9 +332,6 @@ func TestCreateAppVersionCommand_SpecFileSuite(t *testing.T) {
335332
}
336333
ctx.AddStringFlag("spec", tt.specPath)
337334

338-
serverDetails := &config.ServerDetails{
339-
Url: "https://example.com",
340-
}
341335
var actualPayload *model.CreateAppVersionRequest
342336
mockVersionService := mockversions.NewMockVersionService(ctrl)
343337
if !tt.expectsError {
@@ -350,7 +344,6 @@ func TestCreateAppVersionCommand_SpecFileSuite(t *testing.T) {
350344

351345
cmd := &createAppVersionCommand{
352346
versionService: mockVersionService,
353-
serverDetails: serverDetails,
354347
}
355348

356349
err := cmd.prepareAndRunCommand(ctx)

0 commit comments

Comments
 (0)