Skip to content

Commit 4b059cc

Browse files
committed
fix test
1 parent 69086aa commit 4b059cc

12 files changed

+19
-17
lines changed

internal/cmd/storagebox/create_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ func TestCreateJSON(t *testing.T) {
143143
},
144144
Server: hcloud.Ptr("u1337.your-storagebox.de"),
145145
System: hcloud.Ptr("FSN1-BX355"),
146-
Stats: &hcloud.StorageBoxStats{
146+
Stats: hcloud.StorageBoxStats{
147147
Size: 0,
148148
SizeData: 0,
149149
SizeSnapshots: 0,

internal/cmd/storagebox/describe_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ func TestDescribe(t *testing.T) {
8080
},
8181
Server: hcloud.Ptr("u1337.your-storagebox.de"),
8282
System: hcloud.Ptr("FSN1-BX355"),
83-
Stats: &hcloud.StorageBoxStats{
83+
Stats: hcloud.StorageBoxStats{
8484
Size: 0,
8585
SizeData: 0,
8686
SizeSnapshots: 0,

internal/cmd/storagebox/list_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ func TestList(t *testing.T) {
3333
StorageBoxType: &hcloud.StorageBoxType{
3434
Name: "bx11",
3535
},
36-
Stats: &hcloud.StorageBoxStats{
36+
Stats: hcloud.StorageBoxStats{
3737
Size: 42 * util.Gibibyte,
3838
},
3939
Labels: map[string]string{
@@ -59,6 +59,7 @@ func TestList(t *testing.T) {
5959
AllWithOpts(
6060
gomock.Any(),
6161
hcloud.StorageBoxListOpts{
62+
Sort: []string{"id:asc"},
6263
ListOpts: hcloud.ListOpts{PerPage: 50},
6364
},
6465
).

internal/cmd/storagebox/snapshot/list_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ func TestList(t *testing.T) {
5353
AllSnapshotsWithOpts(
5454
gomock.Any(),
5555
sb,
56-
hcloud.StorageBoxSnapshotListOpts{},
56+
hcloud.StorageBoxSnapshotListOpts{Sort: []string{"id:asc"}},
5757
).
5858
Return([]*hcloud.StorageBoxSnapshot{
5959
sbs,

internal/cmd/storagebox/subaccount/change_home_directory_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ func TestChangeHomeDirectory(t *testing.T) {
2626
Get(gomock.Any(), "my-storage-box").
2727
Return(sb, nil, nil)
2828
fx.Client.StorageBoxClient.EXPECT().
29-
GetSubaccountByID(gomock.Any(), sb, int64(456)).
29+
GetSubaccount(gomock.Any(), sb, "456").
3030
Return(sbs, nil, nil)
3131
fx.Client.StorageBoxClient.EXPECT().
3232
ChangeSubaccountHomeDirectory(gomock.Any(), sbs, hcloud.StorageBoxSubaccountChangeHomeDirectoryOpts{

internal/cmd/storagebox/subaccount/delete_test.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ func TestDelete(t *testing.T) {
3333
Get(gomock.Any(), "my-storage-box").
3434
Return(sb, nil, nil)
3535
fx.Client.StorageBoxClient.EXPECT().
36-
GetSubaccountByID(gomock.Any(), sb, int64(456)).
36+
GetSubaccount(gomock.Any(), sb, "456").
3737
Return(sbs, nil, nil)
3838
fx.Client.StorageBoxClient.EXPECT().
3939
DeleteSubaccount(gomock.Any(), sbs).
@@ -63,7 +63,7 @@ func TestDeleteMultiple(t *testing.T) {
6363
Name: "my-storage-box",
6464
}
6565

66-
snapshots := []*hcloud.StorageBoxSubaccount{
66+
subaccounts := []*hcloud.StorageBoxSubaccount{
6767
{
6868
ID: 123,
6969
StorageBox: sb,
@@ -83,10 +83,11 @@ func TestDeleteMultiple(t *testing.T) {
8383
Return(sb, nil, nil)
8484

8585
var ids []string
86-
for _, sbs := range snapshots {
87-
ids = append(ids, strconv.FormatInt(sbs.ID, 10))
86+
for _, sbs := range subaccounts {
87+
idStr := strconv.FormatInt(sbs.ID, 10)
88+
ids = append(ids, idStr)
8889
fx.Client.StorageBoxClient.EXPECT().
89-
GetSubaccountByID(gomock.Any(), sb, sbs.ID).
90+
GetSubaccount(gomock.Any(), sb, idStr).
9091
Return(sbs, nil, nil)
9192
fx.Client.StorageBoxClient.EXPECT().
9293
DeleteSubaccount(gomock.Any(), sbs).

internal/cmd/storagebox/subaccount/describe_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ func TestDescribe(t *testing.T) {
5454
Get(gomock.Any(), "my-storage-box").
5555
Return(sb, nil, nil)
5656
fx.Client.StorageBoxClient.EXPECT().
57-
GetSubaccountByID(gomock.Any(), sb, int64(42)).
57+
GetSubaccount(gomock.Any(), sb, "42").
5858
Return(sbs, nil, nil)
5959

6060
out, errOut, err := fx.Run(cmd, []string{"my-storage-box", "42"})

internal/cmd/storagebox/subaccount/list_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ func TestList(t *testing.T) {
5757
AllSubaccountsWithOpts(
5858
gomock.Any(),
5959
sb,
60-
hcloud.StorageBoxSubaccountListOpts{},
60+
hcloud.StorageBoxSubaccountListOpts{Sort: []string{"id:asc"}},
6161
).
6262
Return([]*hcloud.StorageBoxSubaccount{
6363
sbs,

internal/cmd/storagebox/subaccount/reset_password_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ func TestResetPassword(t *testing.T) {
2626
Get(gomock.Any(), "my-storage-box").
2727
Return(sb, nil, nil)
2828
fx.Client.StorageBoxClient.EXPECT().
29-
GetSubaccountByID(gomock.Any(), sb, int64(456)).
29+
GetSubaccount(gomock.Any(), sb, "456").
3030
Return(sbs, nil, nil)
3131
fx.Client.StorageBoxClient.EXPECT().
3232
ResetSubaccountPassword(gomock.Any(), sbs, hcloud.StorageBoxSubaccountResetPasswordOpts{Password: "new-password"}).

internal/cmd/storagebox/subaccount/update_access_settings_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ func TestUpdateAccessSettings(t *testing.T) {
2626
Get(gomock.Any(), "my-storage-box").
2727
Return(sb, nil, nil)
2828
fx.Client.StorageBoxClient.EXPECT().
29-
GetSubaccountByID(gomock.Any(), sb, int64(456)).
29+
GetSubaccount(gomock.Any(), sb, "456").
3030
Return(sbs, nil, nil)
3131
fx.Client.StorageBoxClient.EXPECT().
3232
UpdateSubaccountAccessSettings(gomock.Any(), sbs, hcloud.StorageBoxSubaccountAccessSettingsUpdateOpts{
@@ -41,7 +41,7 @@ func TestUpdateAccessSettings(t *testing.T) {
4141
WaitForActions(gomock.Any(), gomock.Any(), &hcloud.Action{ID: 456}).
4242
Return(nil)
4343

44-
args := []string{"my-storage-box", "456", "--enable-ssh", "--enable-webdav=false", "--readonly=true", "--home-directory", "/new/home"}
44+
args := []string{"my-storage-box", "456", "--enable-ssh", "--enable-webdav=false", "--readonly=true"}
4545
out, errOut, err := fx.Run(cmd, args)
4646

4747
require.NoError(t, err)

0 commit comments

Comments
 (0)