Skip to content

Commit 5cbba79

Browse files
committed
Test that shell is not updated
1 parent 2e02199 commit 5cbba79

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

internal/users/db/db_test.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,13 @@ func TestUpdateUserEntry(t *testing.T) {
144144
Dir: "/new/home/user1",
145145
Shell: "/bin/bash",
146146
},
147+
"user1-new-shell": {
148+
Name: "user1",
149+
UID: 1111,
150+
Gecos: "User1 gecos\nOn multiple lines",
151+
Dir: "/new/home/user1",
152+
Shell: "/new/shell",
153+
},
147154
"user1-without-gecos": {
148155
Name: "user1",
149156
UID: 1111,
@@ -185,6 +192,7 @@ func TestUpdateUserEntry(t *testing.T) {
185192
// User and Group updates
186193
"Update_user_by_changing_attributes": {userCase: "user1-new-attributes", dbFile: "one_user_and_group"},
187194
"Update_user_does_not_change_homedir_if_it_exists": {userCase: "user1-new-homedir", dbFile: "one_user_and_group"},
195+
"Update_user_does_not_change_shell_if_it_exists": {userCase: "user1-new-shell", dbFile: "one_user_and_group"},
188196
"Update_user_by_removing_optional_gecos_field_if_not_set": {userCase: "user1-without-gecos", dbFile: "one_user_and_group"},
189197

190198
// Group updates
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
users:
2+
- name: user1
3+
uid: 1111
4+
gid: 11111
5+
gecos: |-
6+
User1 gecos
7+
On multiple lines
8+
dir: /home/user1
9+
shell: /bin/bash
10+
groups:
11+
- name: group1
12+
gid: 11111
13+
ugid: "12345678"
14+
users_to_groups:
15+
- uid: 1111
16+
gid: 11111

0 commit comments

Comments
 (0)