def test_raw_cron_foo_redhat(self): ''' Assert that raw_cron() is called with the correct cron command and user: RedHat - If instance running with uid that doesn't match crontab user uid, run with -u flag ''' cron.__grains__ = {'os_family': 'RedHat'} with patch.dict(cron.__salt__, {'cmd.run_stdout': MagicMock()}): cron.raw_cron(STUB_USER) cron.__salt__['cmd.run_stdout'].assert_called_with( "crontab -u root -l", rstrip=False, python_shell=False)
def test_raw_cron_foo_redhat(self): ''' Assert that raw_cron() is called with the correct cron command and user: RedHat - If instance running with uid that doesn't match crontab user uid, run with -u flag ''' cron.__grains__ = {'os_family': 'RedHat'} with patch.dict(cron.__salt__, {'cmd.run_stdout': MagicMock()}): cron.raw_cron(STUB_USER) cron.__salt__['cmd.run_stdout'].assert_called_with("crontab -u root -l", rstrip=False, python_shell=False)
def test_raw_cron_foo_aix(self): ''' Assert that raw_cron() is called with the correct cron command and user: AIX - AIX should always run without a -u flag ''' cron.__grains__ = {'os_family': 'AIX'} with patch.dict(cron.__salt__, {'cmd.run_stdout': MagicMock()}): cron.raw_cron(STUB_USER) cron.__salt__['cmd.run_stdout'].assert_called_with("crontab -l", runas=STUB_USER, rstrip=False, python_shell=False)
def test_raw_cron_root_aix(self): ''' Assert that raw_cron() is called with the correct cron command and user: AIX - AIX should always run without a -u flag ''' cron.__grains__ = {'os_family': 'AIX'} with patch.dict(cron.__salt__, {'cmd.run_stdout': MagicMock()}): cron.raw_cron(STUB_USER) cron.__salt__['cmd.run_stdout'].assert_called_with( "crontab -l", runas=STUB_USER, rstrip=False, python_shell=False)
def test_raw_cron_root_redhat(self): ''' Assert that raw_cron() is called with the correct cron command and user: RedHat - If instance running uid matches crontab user uid, runas STUB_USER without -u flag. ''' with patch.dict(cron.__grains__, {'os_family': 'Redhat'}): with patch.dict(cron.__salt__, {'cmd.run_stdout': MagicMock()}): cron.raw_cron(STUB_USER) cron.__salt__['cmd.run_stdout'].assert_called_with( "crontab -l", runas=STUB_USER, rstrip=False, python_shell=False)
def test_raw_cron_foo_redhat(self): ''' Assert that raw_cron() is called with the correct cron command and user: RedHat - If instance running with uid that doesn't match crontab user uid, run with -u flag ''' with patch.dict(cron.__grains__, {'os_family': 'Redhat'}), \ patch.dict(cron.__salt__, {'cmd.run_stdout': MagicMock()}), \ patch('salt.modules.cron._check_instance_uid_match', MagicMock(return_value=False)): cron.raw_cron(STUB_USER) cron.__salt__['cmd.run_stdout'].assert_called_with("crontab -u root -l", ignore_retcode=True, rstrip=False, python_shell=False)
def test_raw_cron_foo_aix(self): ''' Assert that raw_cron() is called with the correct cron command and user: AIX - AIX should always run without a -u flag ''' with patch.dict(cron.__grains__, {'os_family': 'AIX'}), \ patch.dict(cron.__salt__, {'cmd.run_stdout': MagicMock()}), \ patch('salt.modules.cron._check_instance_uid_match', MagicMock(return_value=False)): cron.raw_cron(STUB_USER) cron.__salt__['cmd.run_stdout'].assert_called_with("crontab -l", runas=STUB_USER, ignore_retcode=True, rstrip=False, python_shell=False)