示例#1
0
 def test_release_absent_import_failed_helm_uninstall(self):
     ret = {
         "name": "state_id",
         "changes": {},
         "result": False,
         "comment":
         "'helm.uninstall' modules not available on this minion.",
     }
     self.assertEqual(helm.release_absent("state_id"), ret)
示例#2
0
 def test_release_absent_import_failed_helm_status(self):
     mock_helm_modules = {"helm.uninstall": MagicMock(return_value=True)}
     with patch.dict(helm.__salt__, mock_helm_modules):
         ret = {
             "name": "state_id",
             "changes": {},
             "result": False,
             "comment":
             "'helm.status' modules not available on this minion.",
         }
         self.assertEqual(helm.release_absent("state_id"), ret)
示例#3
0
 def test_release_absent_error(self):
     mock_helm_modules = {
         "helm.status": MagicMock(return_value={}),
         "helm.uninstall": MagicMock(return_value="error"),
     }
     with patch.dict(helm.__salt__, mock_helm_modules):
         ret = {
             "name": "state_id",
             "result": False,
             "comment": "error",
             "changes": {},
         }
         self.assertEqual(helm.release_absent("state_id"), ret)
示例#4
0
 def test_release_absent_success(self):
     mock_helm_modules = {
         "helm.status": MagicMock(return_value={}),
         "helm.uninstall": MagicMock(return_value=True),
     }
     with patch.dict(helm.__salt__, mock_helm_modules):
         ret = {
             "name": "state_id",
             "result": True,
             "comment": "Helm release state_id is absent.",
             "changes": {
                 "absent": "state_id"
             },
         }
         self.assertEqual(helm.release_absent("state_id"), ret)
示例#5
0
 def test_release_absent_is_testing(self):
     mock_helm_modules = {
         "helm.status": MagicMock(return_value=True),
         "helm.uninstall": 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 release would have been uninstalled.",
                 "changes": {},
             }
             self.assertEqual(helm.release_absent("state_id"), ret)