diff options
author | Marco Trevisan (Treviño) <[email protected]> | 2023-09-22 14:56:36 +0200 |
---|---|---|
committer | Marco Trevisan (Treviño) <[email protected]> | 2023-11-30 02:49:29 +0100 |
commit | 01f62f11f7aa7a84b89287737822f2458a5adf40 (patch) | |
tree | 5feaf54139d8c717bb8336c13cdfe329fb612f51 | |
parent | 31a452ad25b91f3cbdaf33273a40d8693056700b (diff) |
transaction_test: Add tests checking the loaded services match
-rw-r--r-- | transaction_test.go | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/transaction_test.go b/transaction_test.go index e5da07b..b5b807e 100644 --- a/transaction_test.go +++ b/transaction_test.go @@ -160,6 +160,13 @@ func TestPAM_005(t *testing.T) { if err != nil { t.Fatalf("start #error: %v", err) } + service, err := tx.GetItem(Service) + if err != nil { + t.Fatalf("GetItem #error: %v", err) + } + if service != "passwd" { + t.Fatalf("Unexpected service: %v", service) + } err = tx.ChangeAuthTok(Silent) if err != nil { t.Fatalf("chauthtok #error: %v", err) @@ -234,6 +241,13 @@ func TestPAM_ConfDir(t *testing.T) { // nothing else we do, we don't support it. return } + service, err := tx.GetItem(Service) + if err != nil { + t.Fatalf("GetItem #error: %v", err) + } + if service != "permit-service" { + t.Fatalf("Unexpected service: %v", service) + } if err != nil { t.Fatalf("start #error: %v", err) } @@ -285,6 +299,13 @@ func TestPAM_ConfDir_InfoMessage(t *testing.T) { if err != nil { t.Fatalf("start #error: %v", err) } + service, err := tx.GetItem(Service) + if err != nil { + t.Fatalf("GetItem #error: %v", err) + } + if service != "echo-service" { + t.Fatalf("Unexpected service: %v", service) + } err = tx.Authenticate(0) if err != nil { t.Fatalf("authenticate #error: %v", err) @@ -302,6 +323,13 @@ func TestPAM_ConfDir_Deny(t *testing.T) { if err != nil { t.Fatalf("start #error: %v", err) } + service, err := tx.GetItem(Service) + if err != nil { + t.Fatalf("GetItem #error: %v", err) + } + if service != "deny-service" { + t.Fatalf("Unexpected service: %v", service) + } err = tx.Authenticate(0) if err == nil { t.Fatalf("authenticate #expected an error") |