示例#1
0
 def test_alpha_certs_renew_error(self):
     '''
     Test kuebadm.alpha_certs_renew 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.alpha_certs_renew()
示例#2
0
 def test_alpha_certs_renew_error(self):
     """
     Test kuebadm.alpha_certs_renew 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.alpha_certs_renew()
示例#3
0
 def test_alpha_certs_renew_params(self):
     '''
     Test kuebadm.alpha_certs_renew 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.alpha_certs_renew(rootfs='/mnt') == 'stdout'
         salt_mock['cmd.run_all'].assert_called_with(
             ['kubeadm', 'alpha', 'certs', 'renew', '--rootfs', '/mnt'])
示例#4
0
 def test_alpha_certs_renew_params(self):
     """
     Test kuebadm.alpha_certs_renew 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.alpha_certs_renew(rootfs="/mnt") == "stdout"
         salt_mock["cmd.run_all"].assert_called_with(
             ["kubeadm", "alpha", "certs", "renew", "--rootfs", "/mnt"])