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()
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()
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'])
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"])