def test_write_cron_file_foo_rh(self): ''' Assert that write_cron_file() 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.retcode': MagicMock()}): cron.write_cron_file('foo', STUB_PATH) cron.__salt__['cmd.retcode'].assert_called_with("crontab -u foo /tmp", python_shell=False)
def test_write_cron_file_foo_rh(self): ''' Assert that write_cron_file() 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.retcode': MagicMock()}): cron.write_cron_file('foo', STUB_PATH) cron.__salt__['cmd.retcode'].assert_called_with( "crontab -u foo /tmp", python_shell=False)
def test_write_cron_file_foo_aix(self): ''' Assert that write_cron_file() 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'}): with patch.dict(cron.__salt__, {'cmd.retcode': MagicMock()}): cron.write_cron_file('foo', STUB_PATH) cron.__salt__['cmd.retcode'].assert_called_with( "crontab /tmp", runas='foo', python_shell=False)
def test_write_cron_file_root_sol(self): ''' Assert that write_cron_file() is called with the correct cron command and user: Solaris - Solaris should always run without a -u flag ''' with patch.dict(cron.__grains__, {'os_family': 'RedHat'}): with patch.dict(cron.__salt__, {'cmd.retcode': MagicMock()}): cron.write_cron_file(STUB_USER, STUB_PATH) cron.__salt__['cmd.retcode'].assert_called_with( "crontab /tmp", runas=STUB_USER, python_shell=False)
def test_write_cron_file_root_rh(self): ''' Assert that write_cron_file() 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.retcode': MagicMock()}): cron.write_cron_file(STUB_USER, STUB_PATH) cron.__salt__['cmd.retcode'].assert_called_with( "crontab /tmp", runas=STUB_USER, python_shell=False)
def test_write_cron_file_foo_aix(self): ''' Assert that write_cron_file() 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.retcode': MagicMock()}): cron.write_cron_file('foo', STUB_PATH) cron.__salt__['cmd.retcode'].assert_called_with("crontab /tmp", runas='foo', python_shell=False)
def test_write_cron_file_root_sol(self): ''' Assert that write_cron_file() is called with the correct cron command and user: Solaris - Solaris should always run without a -u flag ''' cron.__grains__ = {'os_family': 'Solaris'} with patch.dict(cron.__salt__, {'cmd.retcode': MagicMock()}): cron.write_cron_file(STUB_USER, STUB_PATH) cron.__salt__['cmd.retcode'].assert_called_with("crontab /tmp", runas=STUB_USER, python_shell=False)
def test_write_cron_file_root_rh(self): ''' Assert that write_cron_file() is called with the correct cron command and user: RedHat - If instance running uid matches crontab user uid, runas STUB_USER without -u flag. ''' cron.__grains__ = {'os_family': 'RedHat'} with patch.dict(cron.__salt__, {'cmd.retcode': MagicMock()}): cron.write_cron_file(STUB_USER, STUB_PATH) cron.__salt__['cmd.retcode'].assert_called_with("crontab /tmp", runas=STUB_USER, python_shell=False)
def test_write_cron_file_root_rh(self): ''' Assert that write_cron_file() is called with the correct cron command and user: RedHat - If instance running uid matches crontab user uid, run without -u flag. ''' with patch.dict(cron.__grains__, {'os_family': 'RedHat'}), \ patch.dict(cron.__salt__, {'cmd.retcode': MagicMock()}), \ patch('salt.modules.cron._check_instance_uid_match', new=MagicMock(return_value=True)): cron.write_cron_file(STUB_USER, STUB_PATH) cron.__salt__['cmd.retcode'].assert_called_with("crontab /tmp", python_shell=False)
def test_write_cron_file_root_aix(self): ''' Assert that write_cron_file() 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.retcode': MagicMock()}), \ patch('salt.modules.cron._check_instance_uid_match', MagicMock(return_value=True)): cron.write_cron_file(STUB_USER, STUB_PATH) cron.__salt__['cmd.retcode'].assert_called_with("crontab /tmp", runas=STUB_USER, python_shell=False)
def test_write_cron_file_foo_rh(self): ''' Assert that write_cron_file() is called with the correct cron command and user: RedHat - If instance running with uid that doesn't match crontab user uid, runas foo ''' with patch.dict(cron.__grains__, {'os_family': 'RedHat'}), \ patch.dict(cron.__salt__, {'cmd.retcode': MagicMock()}), \ patch('salt.modules.cron._check_instance_uid_match', MagicMock(return_value=False)): cron.write_cron_file('foo', STUB_PATH) cron.__salt__['cmd.retcode'].assert_called_with("crontab /tmp", runas='foo', python_shell=False)