#! /bin/sh

set -e

# testing the action of the patch
# features/Add-helpful-header-to-new-crontab.patch

echo "================= adding user 'dummy' ====================="
getent passwd dummy || adduser --disabled-password --gecos "" dummy

echo "========= make user 'dummy' fill his crontab =============="
# stderr must be deactivated since crontab will report there
# that there is no initial crontab for user "dummy"
su dummy -c "EDITOR=$(pwd)/debian/tests/cronfiller.py crontab -e" 2>/dev/null

echo "========== testing the crontab of user 'dummy' ============="
crontab -u dummy -l | $(pwd)/debian/tests/testcronheader.py

