Skip to content
This repository was archived by the owner on Apr 11, 2024. It is now read-only.

Commit 2e3ead5

Browse files
committed
Add unit test for empty hashed password
1 parent 9748994 commit 2e3ead5

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

pkg/handlers/generic/mutation/users/inject_test.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,20 @@ func Test_generateBootstrapUser(t *testing.T) {
4949
LockPassword: ptr.To(true),
5050
},
5151
},
52+
{
53+
name: "if user sets empty hashed password, disable password auth and do not set passwd",
54+
args: args{
55+
userFromVariable: v1alpha1.User{
56+
Name: "example",
57+
HashedPassword: "",
58+
},
59+
},
60+
want: bootstrapv1.User{
61+
Name: "example",
62+
Passwd: nil,
63+
LockPassword: ptr.To(true),
64+
},
65+
},
5266
}
5367
for _, tt := range tests {
5468
t.Run(tt.name, func(t *testing.T) {

0 commit comments

Comments
 (0)