summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarco Trevisan (Treviño) <[email protected]>2023-09-19 18:18:56 +0200
committerMarco Trevisan (Treviño) <[email protected]>2023-09-19 18:18:56 +0200
commitca3e79e6055a0ac8e68903036973493007e497fa (patch)
tree1da9a268ee3ca8f9f2fef4ef8674e49c4a54f571
parentd0c0c8bf18fb416e2b76ee4b29c1644d34fb3746 (diff)
transaction_test: Enable conf-dir tests without root
They don't require the `test` user nor being ran as root
-rw-r--r--transaction_test.go9
1 files changed, 1 insertions, 8 deletions
diff --git a/transaction_test.go b/transaction_test.go
index 2d24a37..acf7053 100644
--- a/transaction_test.go
+++ b/transaction_test.go
@@ -168,14 +168,10 @@ func TestPAM_007(t *testing.T) {
func TestPAM_ConfDir(t *testing.T) {
u, _ := user.Current()
- if u.Uid != "0" {
- t.Skip("run this test as root")
- }
c := Credentials{
// the custom service always permits even with wrong password.
Password: "wrongsecret",
}
- tx, err := StartConfDir("my-service", "test", c, ".")
tx, err := StartConfDir("permit-service", u.Username, c, "test-services")
if !CheckPamHasStartConfdir() {
if err == nil {
@@ -195,13 +191,10 @@ func TestPAM_ConfDir(t *testing.T) {
func TestPAM_ConfDir_FailNoServiceOrUnsupported(t *testing.T) {
u, _ := user.Current()
- if u.Uid != "0" {
- t.Skip("run this test as root")
- }
c := Credentials{
Password: "secret",
}
- _, err := StartConfDir("does-not-exists", "test", c, ".")
+ _, err := StartConfDir("does-not-exists", u.Username, c, ".")
if err == nil {
t.Fatalf("authenticate #expected an error")
}