def test_repo_updated_import_failed(self): ret = { "name": "state_id", "changes": {}, "result": False, "comment": "'helm.repo_update' modules not available on this minion.", } self.assertEqual(helm.repo_updated("state_id"), ret)
def test_repo_updated_failed(self): mock_helm_modules = {"helm.repo_update": MagicMock(return_value=False)} with patch.dict(helm.__salt__, mock_helm_modules): ret = { "name": "state_id", "result": False, "comment": "Failed to sync some repositories.", "changes": False, } self.assertEqual(helm.repo_updated("state_id"), ret)
def test_repo_updated_success(self): mock_helm_modules = {"helm.repo_update": MagicMock(return_value=True)} with patch.dict(helm.__salt__, mock_helm_modules): ret = { "name": "state_id", "result": True, "comment": "Helm repo is updated.", "changes": {}, } self.assertEqual(helm.repo_updated("state_id"), ret)
def test_repo_updated_is_testing(self): mock_helm_modules = {"helm.repo_update": MagicMock(return_value=True)} with patch.dict(helm.__salt__, mock_helm_modules): mock__opts__ = {"test": MagicMock(return_value=True)} with patch.dict(helm.__opts__, mock__opts__): ret = { "name": "state_id", "result": None, "comment": "Helm repo would have been updated.", "changes": {}, } self.assertEqual(helm.repo_updated("state_id"), ret)