def test_policy_exists(self): ''' Test if it return whether the policy exists based on rabbitmqctl list_policies. ''' mock_run = MagicMock(return_value='saltstack') with patch.dict(rabbitmq.__salt__, {'cmd.run': mock_run}): self.assertFalse(rabbitmq.policy_exists('/', 'HA'))
def test_policy_exists(self): """ Test if it return whether the policy exists based on rabbitmqctl list_policies. """ mock_run = MagicMock( return_value={"retcode": 0, "stdout": "saltstack", "stderr": ""} ) mock_pkg = MagicMock(return_value="3.0") with patch.dict( rabbitmq.__salt__, {"cmd.run_all": mock_run, "pkg.version": mock_pkg} ), patch.dict(rabbitmq.__grains__, {"os_family": ""}): self.assertFalse(rabbitmq.policy_exists("/", "HA"))
def test_policy_exists(self): ''' Test if it return whether the policy exists based on rabbitmqctl list_policies. ''' mock_run = MagicMock(return_value={ 'retcode': 0, 'stdout': 'saltstack', 'stderr': '' }) mock_pkg = MagicMock(return_value='3.0') with patch.dict(rabbitmq.__salt__, {'cmd.run_all': mock_run, 'pkg.version': mock_pkg}), \ patch.dict(rabbitmq.__grains__, {'os_family': ''}): self.assertFalse(rabbitmq.policy_exists('/', 'HA'))