def test_environment_variables(self): plan = Plan() plan.env('MAILTO', '*****@*****.**') plan.command('command', every='1.day') desired_cron_content = """\ # Begin Plan generated jobs for: main MAILTO="*****@*****.**" 0 0 * * * command # End Plan generated jobs for: main """ self.assert_equal(plan.cron_content, desired_cron_content)
def test_cron_content(self): plan = Plan() plan.command('command', every='1.day') plan.script('script.py', every='1.day', path='/web/scripts', environment={'key': 'value'}, output='null') plan.module('calendar', every='1.day') desired_cron_content = """\ # Begin Plan generated jobs for: main 0 0 * * * command 0 0 * * * cd /web/scripts && key=value %s script.py > /dev/null 2>&1 0 0 * * * %s -m calendar # End Plan generated jobs for: main """ % (sys.executable, sys.executable) self.assert_equal(plan.cron_content, desired_cron_content)