Merge "Increase UT Coverage"
This commit is contained in:
commit
d8d54392af
@ -108,6 +108,14 @@ class ArgsArrayToPatchTest(test_utils.BaseTestCase):
|
|||||||
self.assertEqual([{'op': 'remove', 'path': '/foo'},
|
self.assertEqual([{'op': 'remove', 'path': '/foo'},
|
||||||
{'op': 'remove', 'path': '/extra/bar'}], patch)
|
{'op': 'remove', 'path': '/extra/bar'}], patch)
|
||||||
|
|
||||||
|
def test_args_array_to_patch_invalid_op(self):
|
||||||
|
my_args = {
|
||||||
|
'attributes': ['/foo', 'extra/bar'],
|
||||||
|
'op': 'invalid',
|
||||||
|
}
|
||||||
|
self.assertRaises(exc.CommandError, utils.args_array_to_patch,
|
||||||
|
my_args['op'], my_args['attributes'])
|
||||||
|
|
||||||
|
|
||||||
class FormatLabelsTest(test_utils.BaseTestCase):
|
class FormatLabelsTest(test_utils.BaseTestCase):
|
||||||
|
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
|
|
||||||
import mock
|
import mock
|
||||||
|
|
||||||
|
from magnumclient.common import cliutils as utils
|
||||||
from magnumclient.tests.v1 import shell_test_base
|
from magnumclient.tests.v1 import shell_test_base
|
||||||
from magnumclient.v1 import certificates_shell
|
from magnumclient.v1 import certificates_shell
|
||||||
|
|
||||||
@ -129,3 +130,15 @@ class ShellTest(shell_test_base.TestCommandLineArgument):
|
|||||||
mock_isfile.assert_called_once_with('path/csr.pem')
|
mock_isfile.assert_called_once_with('path/csr.pem')
|
||||||
mock_file.assert_not_called()
|
mock_file.assert_not_called()
|
||||||
mock_cert_create.assert_not_called()
|
mock_cert_create.assert_not_called()
|
||||||
|
|
||||||
|
@mock.patch('magnumclient.v1.clusters.ClusterManager.get')
|
||||||
|
@mock.patch('magnumclient.v1.certificates.CertificateManager.get')
|
||||||
|
def test_ca_show_failure_with_invalid_field(self, mock_cert_get,
|
||||||
|
mock_cluster_get):
|
||||||
|
_error_msg = [".*?^--cluster or --bay"]
|
||||||
|
self.assertRaises(utils.MissingArgs,
|
||||||
|
self._test_arg_failure,
|
||||||
|
'ca-show',
|
||||||
|
_error_msg)
|
||||||
|
mock_cert_get.assert_not_called()
|
||||||
|
mock_cluster_get.assert_not_called()
|
||||||
|
Loading…
Reference in New Issue
Block a user