fix tests for CLI

This commit is contained in:
Tomas Kopecek 2019-06-20 12:07:22 +02:00 committed by Mike McLean
parent c38c024ac5
commit 9524718a91
2 changed files with 9 additions and 8 deletions

View file

@ -1292,7 +1292,7 @@ def handle_import_cg(goptions, session, args):
help=_("Do not display progress of the upload"))
parser.add_option("--link", action="store_true", help=_("Attempt to hardlink instead of uploading"))
parser.add_option("--test", action="store_true", help=_("Don't actually import"))
parser.add_option("--token", action="store", default=None, help=_("Build reservarion token"))
parser.add_option("--token", action="store", default=None, help=_("Build reservation token"))
(options, args) = parser.parse_args(args)
if len(args) < 2:
parser.error(_("Please specify metadata files directory"))

View file

@ -95,7 +95,7 @@ class TestImportCG(utils.CliTestCase):
self.assert_console_message(stdout, expected)
linked_upload_mock.assert_not_called()
session.uploadWrapper.assert_has_calls(calls)
session.CGImport.assert_called_with(metadata, fake_srv_path)
session.CGImport.assert_called_with(metadata, fake_srv_path, None)
# Case 2, running in fg, progress off
with mock.patch(utils.get_builtin_open()):
@ -105,7 +105,7 @@ class TestImportCG(utils.CliTestCase):
self.assert_console_message(stdout, expected)
linked_upload_mock.assert_not_called()
session.uploadWrapper.assert_has_calls(calls)
session.CGImport.assert_called_with(metadata, fake_srv_path)
session.CGImport.assert_called_with(metadata, fake_srv_path, None)
# reset mocks
linked_upload_mock.reset_mock()
@ -129,7 +129,7 @@ class TestImportCG(utils.CliTestCase):
linked_upload_mock.assert_has_calls(calls)
session.uploadWrapper.assert_not_called()
session.CGImport.assert_called_with(metadata, fake_srv_path)
session.CGImport.assert_called_with(metadata, fake_srv_path, None)
# make sure there is no message on output
self.assert_console_message(stdout, '')
@ -213,10 +213,11 @@ class TestImportCG(utils.CliTestCase):
(Specify the --help global option for a list of other help options)
Options:
-h, --help show this help message and exit
--noprogress Do not display progress of the upload
--link Attempt to hardlink instead of uploading
--test Don't actually import
-h, --help show this help message and exit
--noprogress Do not display progress of the upload
--link Attempt to hardlink instead of uploading
--test Don't actually import
--token=TOKEN Build reservation token
""" % self.progname)