From e1748c9800dc4385f32e0e5b16687d2f84135f6c Mon Sep 17 00:00:00 2001
From: Jerome Charaoui <jerome@riseup.net>
Date: Sun, 24 Jan 2021 11:51:16 -0500
Subject: [PATCH] tests: add test for admingroup config parameter

---
 test/backupninja.bats | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/test/backupninja.bats b/test/backupninja.bats
index 083beae..6055af7 100644
--- a/test/backupninja.bats
+++ b/test/backupninja.bats
@@ -72,6 +72,14 @@ create_test_action() {
     echo "${lines[0]}" | grep -qe '^Configuration files must not be writable/readable by group staff!'
 }
 
+@test "permissions: admingroup allows non-root group ownership of backup action" {
+    create_test_action
+    setconfig backupninja.conf admingroup staff
+    chgrp staff "${BATS_TMPDIR}/backup.d/test.sh"
+    run backupninja --now -f "${BATS_TMPDIR}/backupninja.conf"
+    [ "$status" -eq 0 ]
+}
+
 @test "reports: report is mailed when halts > 0" {
     create_test_action halt test_halt
     run backupninja --now -f "${BATS_TMPDIR}/backupninja.conf" --run "${BATS_TMPDIR}/backup.d/test.sh"
-- 
GitLab