test_arguments.py 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627
  1. import pytest
  2. from flexmock import flexmock
  3. from borgmatic.commands import arguments as module
  4. def test_parse_arguments_with_no_arguments_uses_defaults():
  5. config_paths = ['default']
  6. flexmock(module.collect).should_receive('get_default_config_paths').and_return(config_paths)
  7. arguments = module.parse_arguments()
  8. global_arguments = arguments['global']
  9. assert global_arguments.config_paths == config_paths
  10. assert global_arguments.verbosity == 0
  11. assert global_arguments.syslog_verbosity == 0
  12. assert global_arguments.log_file_verbosity == 0
  13. def test_parse_arguments_with_multiple_config_paths_parses_as_list():
  14. flexmock(module.collect).should_receive('get_default_config_paths').and_return(['default'])
  15. arguments = module.parse_arguments('--config', 'myconfig', 'otherconfig')
  16. global_arguments = arguments['global']
  17. assert global_arguments.config_paths == ['myconfig', 'otherconfig']
  18. assert global_arguments.verbosity == 0
  19. assert global_arguments.syslog_verbosity == 0
  20. assert global_arguments.log_file_verbosity == 0
  21. def test_parse_arguments_with_action_after_config_path_omits_action():
  22. flexmock(module.collect).should_receive('get_default_config_paths').and_return(['default'])
  23. arguments = module.parse_arguments('--config', 'myconfig', 'list', '--json')
  24. global_arguments = arguments['global']
  25. assert global_arguments.config_paths == ['myconfig']
  26. assert 'list' in arguments
  27. assert arguments['list'].json
  28. def test_parse_arguments_with_action_after_config_path_omits_aliased_action():
  29. flexmock(module.collect).should_receive('get_default_config_paths').and_return(['default'])
  30. arguments = module.parse_arguments('--config', 'myconfig', 'init', '--encryption', 'repokey')
  31. global_arguments = arguments['global']
  32. assert global_arguments.config_paths == ['myconfig']
  33. assert 'rcreate' in arguments
  34. assert arguments['rcreate'].encryption_mode == 'repokey'
  35. def test_parse_arguments_with_action_and_positional_arguments_after_config_path_omits_action_and_arguments():
  36. flexmock(module.collect).should_receive('get_default_config_paths').and_return(['default'])
  37. arguments = module.parse_arguments('--config', 'myconfig', 'borg', 'key', 'export')
  38. global_arguments = arguments['global']
  39. assert global_arguments.config_paths == ['myconfig']
  40. assert 'borg' in arguments
  41. assert arguments['borg'].options == ['key', 'export']
  42. def test_parse_arguments_with_verbosity_overrides_default():
  43. config_paths = ['default']
  44. flexmock(module.collect).should_receive('get_default_config_paths').and_return(config_paths)
  45. arguments = module.parse_arguments('--verbosity', '1')
  46. global_arguments = arguments['global']
  47. assert global_arguments.config_paths == config_paths
  48. assert global_arguments.verbosity == 1
  49. assert global_arguments.syslog_verbosity == 0
  50. assert global_arguments.log_file_verbosity == 0
  51. def test_parse_arguments_with_syslog_verbosity_overrides_default():
  52. config_paths = ['default']
  53. flexmock(module.collect).should_receive('get_default_config_paths').and_return(config_paths)
  54. arguments = module.parse_arguments('--syslog-verbosity', '2')
  55. global_arguments = arguments['global']
  56. assert global_arguments.config_paths == config_paths
  57. assert global_arguments.verbosity == 0
  58. assert global_arguments.syslog_verbosity == 2
  59. def test_parse_arguments_with_log_file_verbosity_overrides_default():
  60. config_paths = ['default']
  61. flexmock(module.collect).should_receive('get_default_config_paths').and_return(config_paths)
  62. arguments = module.parse_arguments('--log-file-verbosity', '-1')
  63. global_arguments = arguments['global']
  64. assert global_arguments.config_paths == config_paths
  65. assert global_arguments.verbosity == 0
  66. assert global_arguments.syslog_verbosity == 0
  67. assert global_arguments.log_file_verbosity == -1
  68. def test_parse_arguments_with_single_override_parses():
  69. flexmock(module.collect).should_receive('get_default_config_paths').and_return(['default'])
  70. arguments = module.parse_arguments('--override', 'foo.bar=baz')
  71. global_arguments = arguments['global']
  72. assert global_arguments.overrides == ['foo.bar=baz']
  73. def test_parse_arguments_with_multiple_overrides_parses():
  74. flexmock(module.collect).should_receive('get_default_config_paths').and_return(['default'])
  75. arguments = module.parse_arguments('--override', 'foo.bar=baz', 'foo.quux=7')
  76. global_arguments = arguments['global']
  77. assert global_arguments.overrides == ['foo.bar=baz', 'foo.quux=7']
  78. def test_parse_arguments_with_multiple_overrides_and_flags_parses():
  79. flexmock(module.collect).should_receive('get_default_config_paths').and_return(['default'])
  80. arguments = module.parse_arguments(
  81. '--override', 'foo.bar=baz', '--override', 'foo.quux=7', 'this.that=8'
  82. )
  83. global_arguments = arguments['global']
  84. assert global_arguments.overrides == ['foo.bar=baz', 'foo.quux=7', 'this.that=8']
  85. def test_parse_arguments_with_list_json_overrides_default():
  86. arguments = module.parse_arguments('list', '--json')
  87. assert 'list' in arguments
  88. assert arguments['list'].json is True
  89. def test_parse_arguments_with_no_actions_defaults_to_all_actions_enabled():
  90. flexmock(module.collect).should_receive('get_default_config_paths').and_return(['default'])
  91. arguments = module.parse_arguments()
  92. assert 'prune' in arguments
  93. assert 'create' in arguments
  94. assert 'check' in arguments
  95. def test_parse_arguments_with_no_actions_passes_argument_to_relevant_actions():
  96. flexmock(module.collect).should_receive('get_default_config_paths').and_return(['default'])
  97. arguments = module.parse_arguments('--stats', '--list')
  98. assert 'prune' in arguments
  99. assert arguments['prune'].stats
  100. assert arguments['prune'].list_archives
  101. assert 'create' in arguments
  102. assert arguments['create'].stats
  103. assert arguments['create'].list_files
  104. assert 'check' in arguments
  105. def test_parse_arguments_with_help_and_no_actions_shows_global_help(capsys):
  106. flexmock(module.collect).should_receive('get_default_config_paths').and_return(['default'])
  107. with pytest.raises(SystemExit) as exit:
  108. module.parse_arguments('--help')
  109. assert exit.value.code == 0
  110. captured = capsys.readouterr()
  111. assert 'global arguments:' in captured.out
  112. assert 'actions:' in captured.out
  113. def test_parse_arguments_with_help_and_action_shows_action_help(capsys):
  114. flexmock(module.collect).should_receive('get_default_config_paths').and_return(['default'])
  115. with pytest.raises(SystemExit) as exit:
  116. module.parse_arguments('create', '--help')
  117. assert exit.value.code == 0
  118. captured = capsys.readouterr()
  119. assert 'global arguments:' not in captured.out
  120. assert 'actions:' not in captured.out
  121. assert 'create arguments:' in captured.out
  122. def test_parse_arguments_with_action_before_global_options_parses_options():
  123. flexmock(module.collect).should_receive('get_default_config_paths').and_return(['default'])
  124. arguments = module.parse_arguments('prune', '--verbosity', '2')
  125. assert 'prune' in arguments
  126. assert arguments['global'].verbosity == 2
  127. def test_parse_arguments_with_global_options_before_action_parses_options():
  128. flexmock(module.collect).should_receive('get_default_config_paths').and_return(['default'])
  129. arguments = module.parse_arguments('--verbosity', '2', 'prune')
  130. assert 'prune' in arguments
  131. assert arguments['global'].verbosity == 2
  132. def test_parse_arguments_with_prune_action_leaves_other_actions_disabled():
  133. flexmock(module.collect).should_receive('get_default_config_paths').and_return(['default'])
  134. arguments = module.parse_arguments('prune')
  135. assert 'prune' in arguments
  136. assert 'create' not in arguments
  137. assert 'check' not in arguments
  138. def test_parse_arguments_with_multiple_actions_leaves_other_action_disabled():
  139. flexmock(module.collect).should_receive('get_default_config_paths').and_return(['default'])
  140. arguments = module.parse_arguments('create', 'check')
  141. assert 'prune' not in arguments
  142. assert 'create' in arguments
  143. assert 'check' in arguments
  144. def test_parse_arguments_disallows_invalid_argument():
  145. flexmock(module.collect).should_receive('get_default_config_paths').and_return(['default'])
  146. with pytest.raises(ValueError):
  147. module.parse_arguments('--posix-me-harder')
  148. def test_parse_arguments_disallows_encryption_mode_without_init():
  149. flexmock(module.collect).should_receive('get_default_config_paths').and_return(['default'])
  150. with pytest.raises(ValueError):
  151. module.parse_arguments('--config', 'myconfig', '--encryption', 'repokey')
  152. def test_parse_arguments_allows_encryption_mode_with_init():
  153. flexmock(module.collect).should_receive('get_default_config_paths').and_return(['default'])
  154. module.parse_arguments('--config', 'myconfig', 'init', '--encryption', 'repokey')
  155. def test_parse_arguments_requires_encryption_mode_with_init():
  156. flexmock(module.collect).should_receive('get_default_config_paths').and_return(['default'])
  157. with pytest.raises(SystemExit):
  158. module.parse_arguments('--config', 'myconfig', 'init')
  159. def test_parse_arguments_disallows_append_only_without_init():
  160. flexmock(module.collect).should_receive('get_default_config_paths').and_return(['default'])
  161. with pytest.raises(ValueError):
  162. module.parse_arguments('--config', 'myconfig', '--append-only')
  163. def test_parse_arguments_disallows_storage_quota_without_init():
  164. flexmock(module.collect).should_receive('get_default_config_paths').and_return(['default'])
  165. with pytest.raises(ValueError):
  166. module.parse_arguments('--config', 'myconfig', '--storage-quota', '5G')
  167. def test_parse_arguments_allows_init_and_prune():
  168. flexmock(module.collect).should_receive('get_default_config_paths').and_return(['default'])
  169. module.parse_arguments('--config', 'myconfig', 'init', '--encryption', 'repokey', 'prune')
  170. def test_parse_arguments_allows_init_and_create():
  171. flexmock(module.collect).should_receive('get_default_config_paths').and_return(['default'])
  172. module.parse_arguments('--config', 'myconfig', 'init', '--encryption', 'repokey', 'create')
  173. def test_parse_arguments_allows_repository_with_extract():
  174. flexmock(module.collect).should_receive('get_default_config_paths').and_return(['default'])
  175. module.parse_arguments(
  176. '--config', 'myconfig', 'extract', '--repository', 'test.borg', '--archive', 'test'
  177. )
  178. def test_parse_arguments_allows_repository_with_mount():
  179. flexmock(module.collect).should_receive('get_default_config_paths').and_return(['default'])
  180. module.parse_arguments(
  181. '--config',
  182. 'myconfig',
  183. 'mount',
  184. '--repository',
  185. 'test.borg',
  186. '--archive',
  187. 'test',
  188. '--mount-point',
  189. '/mnt',
  190. )
  191. def test_parse_arguments_allows_repository_with_list():
  192. flexmock(module.collect).should_receive('get_default_config_paths').and_return(['default'])
  193. module.parse_arguments('--config', 'myconfig', 'list', '--repository', 'test.borg')
  194. def test_parse_arguments_disallows_archive_unless_action_consumes_it():
  195. flexmock(module.collect).should_receive('get_default_config_paths').and_return(['default'])
  196. with pytest.raises(ValueError):
  197. module.parse_arguments('--config', 'myconfig', '--archive', 'test')
  198. def test_parse_arguments_disallows_paths_unless_action_consumes_it():
  199. flexmock(module.collect).should_receive('get_default_config_paths').and_return(['default'])
  200. with pytest.raises(ValueError):
  201. module.parse_arguments('--config', 'myconfig', '--path', 'test')
  202. def test_parse_arguments_disallows_other_actions_with_config_bootstrap():
  203. flexmock(module.collect).should_receive('get_default_config_paths').and_return(['default'])
  204. with pytest.raises(ValueError):
  205. module.parse_arguments('config', 'bootstrap', '--repository', 'test.borg', 'list')
  206. def test_parse_arguments_allows_archive_with_extract():
  207. flexmock(module.collect).should_receive('get_default_config_paths').and_return(['default'])
  208. module.parse_arguments('--config', 'myconfig', 'extract', '--archive', 'test')
  209. def test_parse_arguments_allows_archive_with_mount():
  210. flexmock(module.collect).should_receive('get_default_config_paths').and_return(['default'])
  211. module.parse_arguments(
  212. '--config', 'myconfig', 'mount', '--archive', 'test', '--mount-point', '/mnt'
  213. )
  214. def test_parse_arguments_allows_archive_with_restore():
  215. flexmock(module.collect).should_receive('get_default_config_paths').and_return(['default'])
  216. module.parse_arguments('--config', 'myconfig', 'restore', '--archive', 'test')
  217. def test_parse_arguments_allows_archive_with_list():
  218. flexmock(module.collect).should_receive('get_default_config_paths').and_return(['default'])
  219. module.parse_arguments('--config', 'myconfig', 'list', '--archive', 'test')
  220. def test_parse_arguments_requires_archive_with_extract():
  221. flexmock(module.collect).should_receive('get_default_config_paths').and_return(['default'])
  222. with pytest.raises(SystemExit):
  223. module.parse_arguments('--config', 'myconfig', 'extract')
  224. def test_parse_arguments_requires_archive_with_restore():
  225. flexmock(module.collect).should_receive('get_default_config_paths').and_return(['default'])
  226. with pytest.raises(SystemExit):
  227. module.parse_arguments('--config', 'myconfig', 'restore')
  228. def test_parse_arguments_requires_mount_point_with_mount():
  229. flexmock(module.collect).should_receive('get_default_config_paths').and_return(['default'])
  230. with pytest.raises(SystemExit):
  231. module.parse_arguments('--config', 'myconfig', 'mount', '--archive', 'test')
  232. def test_parse_arguments_requires_mount_point_with_umount():
  233. flexmock(module.collect).should_receive('get_default_config_paths').and_return(['default'])
  234. with pytest.raises(SystemExit):
  235. module.parse_arguments('--config', 'myconfig', 'umount')
  236. def test_parse_arguments_allows_progress_before_create():
  237. flexmock(module.collect).should_receive('get_default_config_paths').and_return(['default'])
  238. module.parse_arguments('--progress', 'create', 'list')
  239. def test_parse_arguments_allows_progress_after_create():
  240. flexmock(module.collect).should_receive('get_default_config_paths').and_return(['default'])
  241. module.parse_arguments('create', '--progress', 'list')
  242. def test_parse_arguments_allows_progress_and_extract():
  243. flexmock(module.collect).should_receive('get_default_config_paths').and_return(['default'])
  244. module.parse_arguments('--progress', 'extract', '--archive', 'test', 'list')
  245. def test_parse_arguments_disallows_progress_without_create():
  246. flexmock(module.collect).should_receive('get_default_config_paths').and_return(['default'])
  247. with pytest.raises(ValueError):
  248. module.parse_arguments('--progress', 'list')
  249. def test_parse_arguments_with_stats_and_create_flags_does_not_raise():
  250. flexmock(module.collect).should_receive('get_default_config_paths').and_return(['default'])
  251. module.parse_arguments('--stats', 'create', 'list')
  252. def test_parse_arguments_with_stats_and_prune_flags_does_not_raise():
  253. flexmock(module.collect).should_receive('get_default_config_paths').and_return(['default'])
  254. module.parse_arguments('--stats', 'prune', 'list')
  255. def test_parse_arguments_with_stats_flag_but_no_create_or_prune_flag_raises_value_error():
  256. flexmock(module.collect).should_receive('get_default_config_paths').and_return(['default'])
  257. with pytest.raises(ValueError):
  258. module.parse_arguments('--stats', 'list')
  259. def test_parse_arguments_with_list_and_create_flags_does_not_raise():
  260. flexmock(module.collect).should_receive('get_default_config_paths').and_return(['default'])
  261. module.parse_arguments('--list', 'create')
  262. def test_parse_arguments_with_list_and_prune_flags_does_not_raise():
  263. flexmock(module.collect).should_receive('get_default_config_paths').and_return(['default'])
  264. module.parse_arguments('--list', 'prune')
  265. def test_parse_arguments_with_list_flag_but_no_relevant_action_raises_value_error():
  266. flexmock(module.collect).should_receive('get_default_config_paths').and_return(['default'])
  267. with pytest.raises(SystemExit):
  268. module.parse_arguments('--list', 'rcreate')
  269. def test_parse_arguments_disallows_list_with_progress_for_create_action():
  270. flexmock(module.collect).should_receive('get_default_config_paths').and_return(['default'])
  271. with pytest.raises(ValueError):
  272. module.parse_arguments('create', '--list', '--progress')
  273. def test_parse_arguments_disallows_list_with_json_for_create_action():
  274. flexmock(module.collect).should_receive('get_default_config_paths').and_return(['default'])
  275. with pytest.raises(ValueError):
  276. module.parse_arguments('create', '--list', '--json')
  277. def test_parse_arguments_allows_json_with_list_or_info():
  278. flexmock(module.collect).should_receive('get_default_config_paths').and_return(['default'])
  279. module.parse_arguments('list', '--json')
  280. module.parse_arguments('info', '--json')
  281. def test_parse_arguments_disallows_json_with_both_list_and_info():
  282. flexmock(module.collect).should_receive('get_default_config_paths').and_return(['default'])
  283. with pytest.raises(ValueError):
  284. module.parse_arguments('list', 'info', '--json')
  285. def test_parse_arguments_disallows_json_with_both_list_and_rinfo():
  286. flexmock(module.collect).should_receive('get_default_config_paths').and_return(['default'])
  287. with pytest.raises(ValueError):
  288. module.parse_arguments('list', 'rinfo', '--json')
  289. def test_parse_arguments_disallows_json_with_both_rinfo_and_info():
  290. flexmock(module.collect).should_receive('get_default_config_paths').and_return(['default'])
  291. with pytest.raises(ValueError):
  292. module.parse_arguments('rinfo', 'info', '--json')
  293. def test_parse_arguments_disallows_transfer_with_both_archive_and_match_archives():
  294. flexmock(module.collect).should_receive('get_default_config_paths').and_return(['default'])
  295. with pytest.raises(ValueError):
  296. module.parse_arguments(
  297. 'transfer',
  298. '--source-repository',
  299. 'source.borg',
  300. '--archive',
  301. 'foo',
  302. '--match-archives',
  303. 'sh:*bar',
  304. )
  305. def test_parse_arguments_disallows_list_with_both_prefix_and_match_archives():
  306. flexmock(module.collect).should_receive('get_default_config_paths').and_return(['default'])
  307. with pytest.raises(ValueError):
  308. module.parse_arguments('list', '--prefix', 'foo', '--match-archives', 'sh:*bar')
  309. def test_parse_arguments_disallows_rlist_with_both_prefix_and_match_archives():
  310. flexmock(module.collect).should_receive('get_default_config_paths').and_return(['default'])
  311. with pytest.raises(ValueError):
  312. module.parse_arguments('rlist', '--prefix', 'foo', '--match-archives', 'sh:*bar')
  313. def test_parse_arguments_disallows_info_with_both_archive_and_match_archives():
  314. flexmock(module.collect).should_receive('get_default_config_paths').and_return(['default'])
  315. with pytest.raises(ValueError):
  316. module.parse_arguments('info', '--archive', 'foo', '--match-archives', 'sh:*bar')
  317. def test_parse_arguments_disallows_info_with_both_archive_and_prefix():
  318. flexmock(module.collect).should_receive('get_default_config_paths').and_return(['default'])
  319. with pytest.raises(ValueError):
  320. module.parse_arguments('info', '--archive', 'foo', '--prefix', 'bar')
  321. def test_parse_arguments_disallows_info_with_both_prefix_and_match_archives():
  322. flexmock(module.collect).should_receive('get_default_config_paths').and_return(['default'])
  323. with pytest.raises(ValueError):
  324. module.parse_arguments('info', '--prefix', 'foo', '--match-archives', 'sh:*bar')
  325. def test_parse_arguments_check_only_extract_does_not_raise_extract_subparser_error():
  326. flexmock(module.collect).should_receive('get_default_config_paths').and_return(['default'])
  327. module.parse_arguments('check', '--only', 'extract')
  328. def test_parse_arguments_extract_archive_check_does_not_raise_check_subparser_error():
  329. flexmock(module.collect).should_receive('get_default_config_paths').and_return(['default'])
  330. module.parse_arguments('extract', '--archive', 'check')
  331. def test_parse_arguments_extract_with_check_only_extract_does_not_raise():
  332. flexmock(module.collect).should_receive('get_default_config_paths').and_return(['default'])
  333. module.parse_arguments('extract', '--archive', 'name', 'check', '--only', 'extract')
  334. def test_parse_arguments_bootstrap_without_config_errors():
  335. flexmock(module.collect).should_receive('get_default_config_paths').and_return(['default'])
  336. with pytest.raises(ValueError):
  337. module.parse_arguments('bootstrap')
  338. def test_parse_arguments_config_with_no_subaction_errors():
  339. flexmock(module.collect).should_receive('get_default_config_paths').and_return(['default'])
  340. with pytest.raises(ValueError):
  341. module.parse_arguments('config')
  342. def test_parse_arguments_config_with_help_shows_config_help(capsys):
  343. flexmock(module.collect).should_receive('get_default_config_paths').and_return(['default'])
  344. with pytest.raises(SystemExit) as exit:
  345. module.parse_arguments('config', '--help')
  346. assert exit.value.code == 0
  347. captured = capsys.readouterr()
  348. assert 'global arguments:' not in captured.out
  349. assert 'config arguments:' in captured.out
  350. assert 'config sub-actions:' in captured.out
  351. def test_parse_arguments_config_with_subaction_but_missing_flags_errors():
  352. flexmock(module.collect).should_receive('get_default_config_paths').and_return(['default'])
  353. with pytest.raises(SystemExit) as exit:
  354. module.parse_arguments('config', 'bootstrap')
  355. assert exit.value.code == 2
  356. def test_parse_arguments_config_with_subaction_and_help_shows_subaction_help(capsys):
  357. flexmock(module.collect).should_receive('get_default_config_paths').and_return(['default'])
  358. with pytest.raises(SystemExit) as exit:
  359. module.parse_arguments('config', 'bootstrap', '--help')
  360. assert exit.value.code == 0
  361. captured = capsys.readouterr()
  362. assert 'config bootstrap arguments:' in captured.out
  363. def test_parse_arguments_config_with_subaction_and_required_flags_does_not_raise():
  364. flexmock(module.collect).should_receive('get_default_config_paths').and_return(['default'])
  365. module.parse_arguments('config', 'bootstrap', '--repository', 'repo.borg')
  366. def test_parse_arguments_config_with_subaction_and_global_flags_at_start_does_not_raise():
  367. flexmock(module.collect).should_receive('get_default_config_paths').and_return(['default'])
  368. module.parse_arguments('--verbosity', '1', 'config', 'bootstrap', '--repository', 'repo.borg')
  369. def test_parse_arguments_config_with_subaction_and_global_flags_at_end_does_not_raise():
  370. flexmock(module.collect).should_receive('get_default_config_paths').and_return(['default'])
  371. module.parse_arguments('config', 'bootstrap', '--repository', 'repo.borg', '--verbosity', '1')
  372. def test_parse_arguments_config_with_subaction_and_explicit_config_file_does_not_raise():
  373. flexmock(module.collect).should_receive('get_default_config_paths').and_return(['default'])
  374. module.parse_arguments(
  375. 'config', 'bootstrap', '--repository', 'repo.borg', '--config', 'test.yaml'
  376. )