Add integration test for mount action (#659).

This commit is contained in:
Dan Helfman 2023-05-23 14:49:04 -07:00
parent 9299841a5b
commit 76138faaf3

View file

@ -5,6 +5,8 @@ from flexmock import flexmock
import borgmatic.borg.info import borgmatic.borg.info
import borgmatic.borg.list import borgmatic.borg.list
import borgmatic.borg.mount
import borgmatic.borg.prune
import borgmatic.borg.rlist import borgmatic.borg.rlist
import borgmatic.borg.transfer import borgmatic.borg.transfer
import borgmatic.commands.arguments import borgmatic.commands.arguments
@ -89,6 +91,28 @@ def test_prune_archives_command_does_not_duplicate_flags_or_raise():
) )
def test_mount_archive_command_does_not_duplicate_flags_or_raise():
arguments = borgmatic.commands.arguments.parse_arguments('mount', '--mount-point', 'tmp')[
'mount'
]
flexmock(borgmatic.borg.mount).should_receive('execute_command').replace_with(
assert_command_does_not_duplicate_flags
)
for argument_name in dir(arguments):
if argument_name.startswith('_'):
continue
borgmatic.borg.mount.mount_archive(
'repo',
'archive',
fuzz_argument(arguments, argument_name),
{},
'2.3.4',
argparse.Namespace(log_json=False),
)
def test_make_list_command_does_not_duplicate_flags_or_raise(): def test_make_list_command_does_not_duplicate_flags_or_raise():
arguments = borgmatic.commands.arguments.parse_arguments('list')['list'] arguments = borgmatic.commands.arguments.parse_arguments('list')['list']