pam-moduler: Add test that generates a new debug module and verify it works
We mimic what pam_debug.so does by default, by implementing a similar module fully in go, generated using pam-moduler. This requires various utilities to generate the module and run the tests that are in a separate internal modules so that it can be shared between multiple implementations
This commit is contained in:
35
cmd/pam-moduler/tests/internal/utils/base-module_test.go
Normal file
35
cmd/pam-moduler/tests/internal/utils/base-module_test.go
Normal file
@@ -0,0 +1,35 @@
|
||||
package utils
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/msteinert/pam/v2"
|
||||
)
|
||||
|
||||
func TestMain(t *testing.T) {
|
||||
bm := BaseModule{}
|
||||
|
||||
if bm.AcctMgmt(nil, pam.Flags(0), nil) != nil {
|
||||
t.Fatalf("Unexpected non-nil value")
|
||||
}
|
||||
|
||||
if bm.Authenticate(nil, pam.Flags(0), nil) != nil {
|
||||
t.Fatalf("Unexpected non-nil value")
|
||||
}
|
||||
|
||||
if bm.ChangeAuthTok(nil, pam.Flags(0), nil) != nil {
|
||||
t.Fatalf("Unexpected non-nil value")
|
||||
}
|
||||
|
||||
if bm.OpenSession(nil, pam.Flags(0), nil) != nil {
|
||||
t.Fatalf("Unexpected non-nil value")
|
||||
}
|
||||
|
||||
if bm.CloseSession(nil, pam.Flags(0), nil) != nil {
|
||||
t.Fatalf("Unexpected non-nil value")
|
||||
}
|
||||
|
||||
if bm.SetCred(nil, pam.Flags(0), nil) != nil {
|
||||
t.Fatalf("Unexpected non-nil value")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user