Browse Source

Fix tests

communities
meskio 1 year ago
parent
commit
16816ee445
Signed by: meskio
GPG Key ID: 52B8F5AC97A2DA86
  1. 5
      db/invite_test.go
  2. 12
      ldap/user_test.go

5
db/invite_test.go

@ -67,7 +67,10 @@ func TestListUserInvites(t *testing.T) {
if err != nil {
t.Fatalf("Got an error listing invites: %v", err)
}
if len(invites) != 1 && invites[0] != code {
if len(invites) != 1 {
t.Fatalf("Unexpected number of invites: %v", invites)
}
if invites[0].Code != code {
t.Fatalf("Code not in list of user invites: %v", invites)
}
}

12
ldap/user_test.go

@ -10,7 +10,7 @@ const (
func TestValidate(t *testing.T) {
l := testLdap(t)
err := l.ValidateUser(user, userPass)
_, err := l.ValidateUser(user, userPass)
if err != nil {
t.Errorf("Error on ValidateUser(): %v", err)
}
@ -18,7 +18,7 @@ func TestValidate(t *testing.T) {
func TestValidateFails(t *testing.T) {
l := testLdap(t)
err := l.ValidateUser(user, userPass+"bar")
_, err := l.ValidateUser(user, userPass+"bar")
if err == nil {
t.Errorf("ValidateUser() didn't fail to auth the user")
}
@ -31,7 +31,7 @@ func TestChangePass(t *testing.T) {
t.Errorf("Error on ChangePass(): %v", err)
}
err = l.ValidateUser(user, newPass)
_, err = l.ValidateUser(user, newPass)
if err != nil {
t.Errorf("Error on ValidateUser(): %v", err)
}
@ -50,7 +50,7 @@ func TestChangePassRO(t *testing.T) {
t.Errorf("Error on ChangePass(): %v", err)
}
err = l.ValidateUser(user, newPass)
_, err = l.ValidateUser(user, newPass)
if err == nil {
t.Errorf("ValidateUser() didn't fail to auth the user")
}
@ -63,7 +63,7 @@ func TestChangePassAdmin(t *testing.T) {
t.Fatalf("Error on ChangePassAdmin(): %v", err)
}
err = l.ValidateUser(user, newPass)
_, err = l.ValidateUser(user, newPass)
if err != nil {
t.Errorf("Error on ValidateUser(): %v", err)
}
@ -140,7 +140,7 @@ func TestAddUser(t *testing.T) {
t.Errorf("Error on AddUser(): %v", err)
}
err = l.ValidateUser(newUser, newPass)
_, err = l.ValidateUser(newUser, newPass)
if err != nil {
t.Errorf("Error on ValidateUser(): %v", err)
}

Loading…
Cancel
Save