def test__get_cron_cmdstr(self): cron.__grains__ = __grains__ with patch.dict(cron.__grains__, {'os': None}): self.assertEqual('crontab -u root /tmp', cron._get_cron_cmdstr(STUB_USER, STUB_PATH))
def test__get_cron_cmdstr(self): self.assertEqual('crontab /tmp', cron._get_cron_cmdstr(STUB_PATH))
def test__get_cron_cmdstr_solaris(self): cron.__grains__ = __grains__ with patch.dict(cron.__grains__, {'os': 'Solaris'}): self.assertEqual('su - root -c "crontab /tmp"', cron._get_cron_cmdstr(STUB_USER, STUB_PATH))
def test__get_cron_cmdstr_user(self): ''' Passes if a user is added to crontab command ''' self.assertEqual('crontab -u root /tmp', cron._get_cron_cmdstr(STUB_PATH, STUB_USER))
def test__get_cron_cmdstr(self): cron.__grains__ = __grains__ with patch.dict(cron.__grains__, {'os_family': None}): self.assertEqual('crontab -u root /tmp', cron._get_cron_cmdstr(STUB_USER, STUB_PATH))
def test__get_cron_cmdstr_solaris(self): cron.__grains__ = __grains__ with patch.dict(cron.__grains__, {'os_family': 'Solaris'}): self.assertEqual('su - root -c "crontab /tmp"', cron._get_cron_cmdstr(STUB_USER, STUB_PATH))