add test for reportemail = no

This commit is contained in:
Jérôme Charaoui 2023-02-12 13:32:52 -05:00
parent 51cd07781a
commit 21ff09e2ec
No known key found for this signature in database
GPG Key ID: 69C52F658E988542

View File

@ -3,6 +3,7 @@ load common
teardown_backupninja() {
[ -x /usr/bin/mail.moved ] && mv /usr/bin/mail.moved /usr/bin/mail
[ -x /usr/bin/rsync.moved ] && mv /usr/bin/rsync.moved /usr/bin/rsync
rm -f /var/mail/vagrant
}
create_test_action() {
@ -235,6 +236,16 @@ create_test_action() {
[ "$status" -eq 1 ]
}
@test "reports: email not sent when reportemail is no" {
create_test_action info test_info
setconfig backupninja.conf reportsuccess yes
setconfig backupninja.conf reportinfo yes
setconfig backupninja.conf reportemail no
run backupninja --now -f "${BATS_TMPDIR}/backupninja.conf" --run "${BATS_TMPDIR}/backup.d/test.sh"
[ "$status" -eq 0 ]
! test -f /var/mail/vagrant
}
@test "scheduling: runs when = 'everyday at 01' and time matches" {
create_test_action info test_info
setconfig backupninja.conf when 'everyday at 01'