コード例 #1
0
 def test_token_delete_error(self):
     '''
     Test kuebadm.token_delete 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.token_delete('token')
コード例 #2
0
 def test_token_delete_error(self):
     """
     Test kuebadm.token_delete 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.token_delete("token")
コード例 #3
0
 def test_token_delete(self):
     '''
     Test kuebadm.token_delete without parameters
     '''
     result = {'retcode': 0, 'stdout': 'deleted'}
     salt_mock = {
         'cmd.run_all': MagicMock(return_value=result),
     }
     with patch.dict(kubeadm.__salt__, salt_mock):
         assert kubeadm.token_delete('token')
         salt_mock['cmd.run_all'].assert_called_with(
             ['kubeadm', 'token', 'delete', 'token'])
コード例 #4
0
 def test_token_delete(self):
     """
     Test kuebadm.token_delete without parameters
     """
     result = {"retcode": 0, "stdout": "deleted"}
     salt_mock = {
         "cmd.run_all": MagicMock(return_value=result),
     }
     with patch.dict(kubeadm.__salt__, salt_mock):
         assert kubeadm.token_delete("token")
         salt_mock["cmd.run_all"].assert_called_with(
             ["kubeadm", "token", "delete", "token"])
コード例 #5
0
 def test_token_delete_params(self):
     '''
     Test kuebadm.token_delete with parameters
     '''
     result = {'retcode': 0, 'stdout': 'deleted'}
     salt_mock = {
         'cmd.run_all': MagicMock(return_value=result),
     }
     with patch.dict(kubeadm.__salt__, salt_mock):
         assert kubeadm.token_delete('token',
                                     kubeconfig='/kube.cfg',
                                     rootfs='/mnt')
         salt_mock['cmd.run_all'].assert_called_with([
             'kubeadm', 'token', 'delete', 'token', '--kubeconfig',
             '/kube.cfg', '--rootfs', '/mnt'
         ])
コード例 #6
0
 def test_token_delete_params(self):
     """
     Test kuebadm.token_delete with parameters
     """
     result = {"retcode": 0, "stdout": "deleted"}
     salt_mock = {
         "cmd.run_all": MagicMock(return_value=result),
     }
     with patch.dict(kubeadm.__salt__, salt_mock):
         assert kubeadm.token_delete("token",
                                     kubeconfig="/kube.cfg",
                                     rootfs="/mnt")
         salt_mock["cmd.run_all"].assert_called_with([
             "kubeadm",
             "token",
             "delete",
             "token",
             "--kubeconfig",
             "/kube.cfg",
             "--rootfs",
             "/mnt",
         ])