Exemplo n.º 1
0
 def test_config_view_error(self):
     '''
     Test kuebadm.config_view error
     '''
     result = {'retcode': 1, 'stderr': 'error'}
     salt_mock = {
         'cmd.run_all': MagicMock(return_value=result),
     }
     with patch.dict(kubeadm.__salt__, salt_mock):
         with pytest.raises(CommandExecutionError):
             assert kubeadm.config_view()
Exemplo n.º 2
0
 def test_config_view_error(self):
     """
     Test kuebadm.config_view error
     """
     result = {"retcode": 1, "stderr": "error"}
     salt_mock = {
         "cmd.run_all": MagicMock(return_value=result),
     }
     with patch.dict(kubeadm.__salt__, salt_mock):
         with pytest.raises(CommandExecutionError):
             assert kubeadm.config_view()
Exemplo n.º 3
0
 def test_config_view(self):
     '''
     Test kuebadm.config_view without parameters
     '''
     result = {'retcode': 0, 'stdout': 'stdout'}
     salt_mock = {
         'cmd.run_all': MagicMock(return_value=result),
     }
     with patch.dict(kubeadm.__salt__, salt_mock):
         assert kubeadm.config_view() == 'stdout'
         salt_mock['cmd.run_all'].assert_called_with(
             ['kubeadm', 'config', 'view'])
Exemplo n.º 4
0
 def test_config_view(self):
     """
     Test kuebadm.config_view without parameters
     """
     result = {"retcode": 0, "stdout": "stdout"}
     salt_mock = {
         "cmd.run_all": MagicMock(return_value=result),
     }
     with patch.dict(kubeadm.__salt__, salt_mock):
         assert kubeadm.config_view() == "stdout"
         salt_mock["cmd.run_all"].assert_called_with(
             ["kubeadm", "config", "view"])
Exemplo n.º 5
0
 def test_config_view_params(self):
     '''
     Test kuebadm.config_view with parameters
     '''
     result = {'retcode': 0, 'stdout': 'stdout'}
     salt_mock = {
         'cmd.run_all': MagicMock(return_value=result),
     }
     with patch.dict(kubeadm.__salt__, salt_mock):
         assert kubeadm.config_view(kubeconfig='/kube.cfg',
                                    rootfs='/mnt') == 'stdout'
         salt_mock['cmd.run_all'].assert_called_with([
             'kubeadm', 'config', 'view', '--kubeconfig', '/kube.cfg',
             '--rootfs', '/mnt'
         ])
Exemplo n.º 6
0
 def test_config_view_params(self):
     """
     Test kuebadm.config_view with parameters
     """
     result = {"retcode": 0, "stdout": "stdout"}
     salt_mock = {
         "cmd.run_all": MagicMock(return_value=result),
     }
     with patch.dict(kubeadm.__salt__, salt_mock):
         assert (kubeadm.config_view(kubeconfig="/kube.cfg",
                                     rootfs="/mnt") == "stdout")
         salt_mock["cmd.run_all"].assert_called_with([
             "kubeadm",
             "config",
             "view",
             "--kubeconfig",
             "/kube.cfg",
             "--rootfs",
             "/mnt",
         ])