AB#2222 replace unlicensed passwd package with own implementation

This commit is contained in:
Thomas Tendyck 2022-07-25 14:43:02 +02:00 committed by Thomas Tendyck
parent f57a7e3ed0
commit 48d614c959
8 changed files with 75 additions and 32 deletions

View file

@ -22,12 +22,35 @@ func TestParse(t *testing.T) {
createFile: true,
wantEntries: Entries{
"root": {
Pass: "x",
Uid: "0",
Gid: "0",
Gecos: "root",
Home: "/root",
Shell: "/bin/bash",
Password: "x",
UID: "0",
GID: "0",
GECOS: "root",
Directory: "/root",
Shell: "/bin/bash",
},
},
wantErr: false,
},
"multiple lines": {
passwdContents: "root:x:0:0:root:/root:/bin/bash\nfoo:y:1:2:bar:baz:sh",
createFile: true,
wantEntries: Entries{
"root": {
Password: "x",
UID: "0",
GID: "0",
GECOS: "root",
Directory: "/root",
Shell: "/bin/bash",
},
"foo": {
Password: "y",
UID: "1",
GID: "2",
GECOS: "bar",
Directory: "baz",
Shell: "sh",
},
},
wantErr: false,