1
Fork 0

Improve TestUpgradeDescription.

This commit is contained in:
Juliusz Chroboczek 2024-04-12 00:47:51 +02:00
parent abb90ce3b9
commit 4ad7c2f303
1 changed files with 18 additions and 2 deletions

View File

@ -96,6 +96,22 @@ func TestUpgradeDescription(t *testing.T) {
t.Errorf("%v not equal: %v != %v", k, v1, v2) t.Errorf("%v not equal: %v != %v", k, v1, v2)
} }
} }
if len(d1.FallbackUsers) != len(d2.FallbackUsers) {
t.Errorf("length not equal: %v != %v",
len(d1.FallbackUsers), len(d2.FallbackUsers))
}
for k, v1 := range d1.FallbackUsers {
v2 := d2.FallbackUsers[k]
if !reflect.DeepEqual(v1.Password, v2.Password) ||
!permissionsEqual(
v1.Permissions.Permissions(&d1),
v2.Permissions.Permissions(&d2),
) {
t.Errorf("%v not equal: %v != %v", k, v1, v2)
}
}
} }
func TestNonWritableGroups(t *testing.T) { func TestNonWritableGroups(t *testing.T) {
@ -109,7 +125,7 @@ func TestNonWritableGroups(t *testing.T) {
err = UpdateDescription("test", "", &Description{}) err = UpdateDescription("test", "", &Description{})
if !errors.Is(err, ErrDescriptionsNotWritable) { if !errors.Is(err, ErrDescriptionsNotWritable) {
t.Errorf("UpdateDescription: got %#v, " + t.Errorf("UpdateDescription: got %#v, "+
"expected ErrDescriptionsNotWritable", err) "expected ErrDescriptionsNotWritable", err)
} }
} }
@ -202,7 +218,7 @@ func TestWritableGroups(t *testing.T) {
err = SetUserPassword("test", "jch", Password{ err = SetUserPassword("test", "jch", Password{
Type: "", Type: "",
Key: "pw", Key: "pw",
}) })
if err != nil { if err != nil {
t.Errorf("SetUserPassword: got %v", err) t.Errorf("SetUserPassword: got %v", err)