Commit 4ad7c2f3 authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Improve TestUpgradeDescription.

parent abb90ce3
...@@ -96,6 +96,22 @@ func TestUpgradeDescription(t *testing.T) { ...@@ -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) { ...@@ -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) { ...@@ -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)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment