Testing
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
//go:build !pam
|
||||
|
||||
package pamauth
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"testing"
|
||||
)
|
||||
|
||||
// TestStubUnavailable verifies the default (non-PAM) build reports PAM as
|
||||
// unavailable and Authenticate always fails with ErrUnavailable.
|
||||
func TestStubUnavailable(t *testing.T) {
|
||||
if Available {
|
||||
t.Error("Available should be false in the non-PAM build")
|
||||
}
|
||||
if err := Authenticate("login", "alice", "secret"); !errors.Is(err, ErrUnavailable) {
|
||||
t.Errorf("Authenticate = %v, want ErrUnavailable", err)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user