test_info.py 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607
  1. import logging
  2. import pytest
  3. from flexmock import flexmock
  4. from borgmatic.borg import info as module
  5. from ..test_verbosity import insert_logging_mock
  6. def test_make_info_command_constructs_borg_info_command():
  7. flexmock(module.flags).should_receive('make_flags').and_return(())
  8. flexmock(module.flags).should_receive('make_match_archives_flags').with_args(
  9. None,
  10. None,
  11. '2.3.4',
  12. ).and_return(())
  13. flexmock(module.flags).should_receive('make_flags_from_arguments').and_return(())
  14. flexmock(module.flags).should_receive('make_repository_flags').and_return(('--repo', 'repo'))
  15. command = module.make_info_command(
  16. repository_path='repo',
  17. config={},
  18. local_borg_version='2.3.4',
  19. global_arguments=flexmock(),
  20. info_arguments=flexmock(archive=None, json=False, prefix=None, match_archives=None),
  21. local_path='borg',
  22. remote_path=None,
  23. )
  24. assert command == ('borg', 'info', '--repo', 'repo')
  25. def test_make_info_command_with_log_info_passes_through_to_command():
  26. flexmock(module.flags).should_receive('make_flags').and_return(())
  27. flexmock(module.flags).should_receive('make_match_archives_flags').with_args(
  28. None,
  29. None,
  30. '2.3.4',
  31. ).and_return(())
  32. flexmock(module.flags).should_receive('make_flags_from_arguments').and_return(())
  33. flexmock(module.flags).should_receive('make_repository_flags').and_return(('--repo', 'repo'))
  34. insert_logging_mock(logging.INFO)
  35. command = module.make_info_command(
  36. repository_path='repo',
  37. config={},
  38. local_borg_version='2.3.4',
  39. global_arguments=flexmock(),
  40. info_arguments=flexmock(archive=None, json=False, prefix=None, match_archives=None),
  41. local_path='borg',
  42. remote_path=None,
  43. )
  44. assert command == ('borg', 'info', '--info', '--repo', 'repo')
  45. def test_make_info_command_with_log_info_and_json_omits_borg_logging_flags():
  46. flexmock(module.flags).should_receive('make_flags').and_return(())
  47. flexmock(module.flags).should_receive('make_match_archives_flags').with_args(
  48. None,
  49. None,
  50. '2.3.4',
  51. ).and_return(())
  52. flexmock(module.flags).should_receive('make_flags_from_arguments').and_return(('--json',))
  53. flexmock(module.flags).should_receive('make_repository_flags').and_return(('--repo', 'repo'))
  54. insert_logging_mock(logging.INFO)
  55. command = module.make_info_command(
  56. repository_path='repo',
  57. config={},
  58. local_borg_version='2.3.4',
  59. global_arguments=flexmock(),
  60. info_arguments=flexmock(archive=None, json=True, prefix=None, match_archives=None),
  61. local_path='borg',
  62. remote_path=None,
  63. )
  64. assert command == ('borg', 'info', '--json', '--repo', 'repo')
  65. def test_make_info_command_with_log_debug_passes_through_to_command():
  66. flexmock(module.flags).should_receive('make_flags').and_return(())
  67. flexmock(module.flags).should_receive('make_match_archives_flags').with_args(
  68. None,
  69. None,
  70. '2.3.4',
  71. ).and_return(())
  72. flexmock(module.flags).should_receive('make_flags_from_arguments').and_return(())
  73. flexmock(module.flags).should_receive('make_repository_flags').and_return(('--repo', 'repo'))
  74. insert_logging_mock(logging.DEBUG)
  75. command = module.make_info_command(
  76. repository_path='repo',
  77. config={},
  78. local_borg_version='2.3.4',
  79. global_arguments=flexmock(),
  80. info_arguments=flexmock(archive=None, json=False, prefix=None, match_archives=None),
  81. local_path='borg',
  82. remote_path=None,
  83. )
  84. assert command == ('borg', 'info', '--debug', '--show-rc', '--repo', 'repo')
  85. def test_make_info_command_with_log_debug_and_json_omits_borg_logging_flags():
  86. flexmock(module.flags).should_receive('make_flags').and_return(())
  87. flexmock(module.flags).should_receive('make_match_archives_flags').with_args(
  88. None,
  89. None,
  90. '2.3.4',
  91. ).and_return(())
  92. flexmock(module.flags).should_receive('make_flags_from_arguments').and_return(('--json',))
  93. flexmock(module.flags).should_receive('make_repository_flags').and_return(('--repo', 'repo'))
  94. command = module.make_info_command(
  95. repository_path='repo',
  96. config={},
  97. local_borg_version='2.3.4',
  98. global_arguments=flexmock(),
  99. info_arguments=flexmock(archive=None, json=True, prefix=None, match_archives=None),
  100. local_path='borg',
  101. remote_path=None,
  102. )
  103. assert command == ('borg', 'info', '--json', '--repo', 'repo')
  104. def test_make_info_command_with_json_passes_through_to_command():
  105. flexmock(module.flags).should_receive('make_flags').and_return(())
  106. flexmock(module.flags).should_receive('make_match_archives_flags').with_args(
  107. None,
  108. None,
  109. '2.3.4',
  110. ).and_return(())
  111. flexmock(module.flags).should_receive('make_flags_from_arguments').and_return(('--json',))
  112. flexmock(module.flags).should_receive('make_repository_flags').and_return(('--repo', 'repo'))
  113. command = module.make_info_command(
  114. repository_path='repo',
  115. config={},
  116. local_borg_version='2.3.4',
  117. global_arguments=flexmock(),
  118. info_arguments=flexmock(archive=None, json=True, prefix=None, match_archives=None),
  119. local_path='borg',
  120. remote_path=None,
  121. )
  122. assert command == ('borg', 'info', '--json', '--repo', 'repo')
  123. def test_make_info_command_with_archive_uses_match_archives_flags():
  124. flexmock(module.flags).should_receive('make_flags').and_return(())
  125. flexmock(module.flags).should_receive('make_match_archives_flags').with_args(
  126. 'archive',
  127. None,
  128. '2.3.4',
  129. ).and_return(('--match-archives', 'archive'))
  130. flexmock(module.flags).should_receive('make_flags_from_arguments').and_return(())
  131. flexmock(module.flags).should_receive('make_repository_flags').and_return(('--repo', 'repo'))
  132. command = module.make_info_command(
  133. repository_path='repo',
  134. config={},
  135. local_borg_version='2.3.4',
  136. global_arguments=flexmock(),
  137. info_arguments=flexmock(archive='archive', json=False, prefix=None, match_archives=None),
  138. local_path='borg',
  139. remote_path=None,
  140. )
  141. assert command == ('borg', 'info', '--match-archives', 'archive', '--repo', 'repo')
  142. def test_make_info_command_with_local_path_passes_through_to_command():
  143. flexmock(module.flags).should_receive('make_flags').and_return(())
  144. flexmock(module.flags).should_receive('make_match_archives_flags').with_args(
  145. None,
  146. None,
  147. '2.3.4',
  148. ).and_return(())
  149. flexmock(module.flags).should_receive('make_flags_from_arguments').and_return(())
  150. flexmock(module.flags).should_receive('make_repository_flags').and_return(('--repo', 'repo'))
  151. command = module.make_info_command(
  152. repository_path='repo',
  153. config={},
  154. local_borg_version='2.3.4',
  155. global_arguments=flexmock(),
  156. info_arguments=flexmock(archive=None, json=False, prefix=None, match_archives=None),
  157. local_path='borg1',
  158. remote_path=None,
  159. )
  160. assert command == ('borg1', 'info', '--repo', 'repo')
  161. def test_make_info_command_with_remote_path_passes_through_to_command():
  162. flexmock(module.flags).should_receive('make_flags').and_return(())
  163. flexmock(module.flags).should_receive('make_flags').with_args(
  164. 'remote-path',
  165. 'borg1',
  166. ).and_return(('--remote-path', 'borg1'))
  167. flexmock(module.flags).should_receive('make_match_archives_flags').with_args(
  168. None,
  169. None,
  170. '2.3.4',
  171. ).and_return(())
  172. flexmock(module.flags).should_receive('make_flags_from_arguments').and_return(())
  173. flexmock(module.flags).should_receive('make_repository_flags').and_return(('--repo', 'repo'))
  174. command = module.make_info_command(
  175. repository_path='repo',
  176. config={},
  177. local_borg_version='2.3.4',
  178. global_arguments=flexmock(),
  179. info_arguments=flexmock(archive=None, json=False, prefix=None, match_archives=None),
  180. local_path='borg',
  181. remote_path='borg1',
  182. )
  183. assert command == ('borg', 'info', '--remote-path', 'borg1', '--repo', 'repo')
  184. def test_make_info_command_with_umask_passes_through_to_command():
  185. flexmock(module.flags).should_receive('make_flags').replace_with(
  186. lambda name, value: (f'--{name}', value) if value else (),
  187. )
  188. flexmock(module.flags).should_receive('make_match_archives_flags').with_args(
  189. None,
  190. None,
  191. '2.3.4',
  192. ).and_return(())
  193. flexmock(module.flags).should_receive('make_flags_from_arguments').and_return(())
  194. flexmock(module.flags).should_receive('make_repository_flags').and_return(('--repo', 'repo'))
  195. command = module.make_info_command(
  196. repository_path='repo',
  197. config={'umask': '077'},
  198. local_borg_version='2.3.4',
  199. global_arguments=flexmock(),
  200. info_arguments=flexmock(archive=None, json=False, prefix=None, match_archives=None),
  201. local_path='borg',
  202. remote_path=None,
  203. )
  204. assert command == ('borg', 'info', '--umask', '077', '--repo', 'repo')
  205. def test_make_info_command_with_log_json_passes_through_to_command():
  206. flexmock(module.flags).should_receive('make_flags').and_return(())
  207. flexmock(module.flags).should_receive('make_flags').with_args('log-json', True).and_return(
  208. ('--log-json',),
  209. )
  210. flexmock(module.flags).should_receive('make_match_archives_flags').with_args(
  211. None,
  212. None,
  213. '2.3.4',
  214. ).and_return(())
  215. flexmock(module.flags).should_receive('make_flags_from_arguments').and_return(())
  216. flexmock(module.flags).should_receive('make_repository_flags').and_return(('--repo', 'repo'))
  217. command = module.make_info_command(
  218. repository_path='repo',
  219. config={'log_json': True},
  220. local_borg_version='2.3.4',
  221. global_arguments=flexmock(),
  222. info_arguments=flexmock(archive=None, json=False, prefix=None, match_archives=None),
  223. local_path='borg',
  224. remote_path=None,
  225. )
  226. assert command == ('borg', 'info', '--log-json', '--repo', 'repo')
  227. def test_make_info_command_with_lock_wait_passes_through_to_command():
  228. flexmock(module.flags).should_receive('make_flags').and_return(())
  229. flexmock(module.flags).should_receive('make_flags').with_args('lock-wait', 5).and_return(
  230. ('--lock-wait', '5'),
  231. )
  232. flexmock(module.flags).should_receive('make_match_archives_flags').with_args(
  233. None,
  234. None,
  235. '2.3.4',
  236. ).and_return(())
  237. flexmock(module.flags).should_receive('make_flags_from_arguments').and_return(())
  238. flexmock(module.flags).should_receive('make_repository_flags').and_return(('--repo', 'repo'))
  239. config = {'lock_wait': 5}
  240. command = module.make_info_command(
  241. repository_path='repo',
  242. config=config,
  243. local_borg_version='2.3.4',
  244. global_arguments=flexmock(),
  245. info_arguments=flexmock(archive=None, json=False, prefix=None, match_archives=None),
  246. local_path='borg',
  247. remote_path=None,
  248. )
  249. assert command == ('borg', 'info', '--lock-wait', '5', '--repo', 'repo')
  250. def test_make_info_command_with_extra_borg_options_passes_through_to_command():
  251. flexmock(module.flags).should_receive('make_flags').and_return(())
  252. flexmock(module.flags).should_receive('make_match_archives_flags').with_args(
  253. None,
  254. None,
  255. '2.3.4',
  256. ).and_return(())
  257. flexmock(module.flags).should_receive('make_flags_from_arguments').and_return(())
  258. flexmock(module.flags).should_receive('make_repository_flags').and_return(('--repo', 'repo'))
  259. config = {'extra_borg_options': {'info': '--extra "value with space"'}}
  260. command = module.make_info_command(
  261. repository_path='repo',
  262. config=config,
  263. local_borg_version='2.3.4',
  264. global_arguments=flexmock(),
  265. info_arguments=flexmock(archive=None, json=False, prefix=None, match_archives=None),
  266. local_path='borg',
  267. remote_path=None,
  268. )
  269. assert command == ('borg', 'info', '--extra', 'value with space', '--repo', 'repo')
  270. def test_make_info_command_transforms_prefix_into_match_archives_flags():
  271. flexmock(module.flags).should_receive('make_flags').and_return(())
  272. flexmock(module.flags).should_receive('make_flags').with_args(
  273. 'match-archives',
  274. 'sh:foo*',
  275. ).and_return(('--match-archives', 'sh:foo*'))
  276. flexmock(module.flags).should_receive('make_match_archives_flags').with_args(
  277. None,
  278. None,
  279. '2.3.4',
  280. ).and_return(())
  281. flexmock(module.flags).should_receive('make_flags_from_arguments').and_return(())
  282. flexmock(module.flags).should_receive('make_repository_flags').and_return(('--repo', 'repo'))
  283. command = module.make_info_command(
  284. repository_path='repo',
  285. config={},
  286. local_borg_version='2.3.4',
  287. global_arguments=flexmock(),
  288. info_arguments=flexmock(archive=None, json=False, prefix='foo'),
  289. local_path='borg',
  290. remote_path=None,
  291. )
  292. assert command == ('borg', 'info', '--match-archives', 'sh:foo*', '--repo', 'repo')
  293. def test_make_info_command_prefers_prefix_over_archive_name_format():
  294. flexmock(module.flags).should_receive('make_flags').and_return(())
  295. flexmock(module.flags).should_receive('make_flags').with_args(
  296. 'match-archives',
  297. 'sh:foo*',
  298. ).and_return(('--match-archives', 'sh:foo*'))
  299. flexmock(module.flags).should_receive('make_match_archives_flags').with_args(
  300. None,
  301. None,
  302. '2.3.4',
  303. ).and_return(())
  304. flexmock(module.flags).should_receive('make_flags_from_arguments').and_return(())
  305. flexmock(module.flags).should_receive('make_repository_flags').and_return(('--repo', 'repo'))
  306. command = module.make_info_command(
  307. repository_path='repo',
  308. config={'archive_name_format': 'bar-{now}'},
  309. local_borg_version='2.3.4',
  310. global_arguments=flexmock(),
  311. info_arguments=flexmock(archive=None, json=False, prefix='foo'),
  312. local_path='borg',
  313. remote_path=None,
  314. )
  315. assert command == ('borg', 'info', '--match-archives', 'sh:foo*', '--repo', 'repo')
  316. def test_make_info_command_transforms_archive_name_format_into_match_archives_flags():
  317. flexmock(module.flags).should_receive('make_flags').and_return(())
  318. flexmock(module.flags).should_receive('make_match_archives_flags').with_args(
  319. None,
  320. 'bar-{now}',
  321. '2.3.4',
  322. ).and_return(('--match-archives', 'sh:bar-*'))
  323. flexmock(module.flags).should_receive('make_flags_from_arguments').and_return(())
  324. flexmock(module.flags).should_receive('make_repository_flags').and_return(('--repo', 'repo'))
  325. command = module.make_info_command(
  326. repository_path='repo',
  327. config={'archive_name_format': 'bar-{now}'},
  328. local_borg_version='2.3.4',
  329. global_arguments=flexmock(),
  330. info_arguments=flexmock(archive=None, json=False, prefix=None, match_archives=None),
  331. local_path='borg',
  332. remote_path=None,
  333. )
  334. assert command == ('borg', 'info', '--match-archives', 'sh:bar-*', '--repo', 'repo')
  335. def test_make_info_command_with_match_archives_option_passes_through_to_command():
  336. flexmock(module.flags).should_receive('make_flags').and_return(())
  337. flexmock(module.flags).should_receive('make_match_archives_flags').with_args(
  338. 'sh:foo-*',
  339. 'bar-{now}',
  340. '2.3.4',
  341. ).and_return(('--match-archives', 'sh:foo-*'))
  342. flexmock(module.flags).should_receive('make_flags_from_arguments').and_return(())
  343. flexmock(module.flags).should_receive('make_repository_flags').and_return(('--repo', 'repo'))
  344. flexmock(module.environment).should_receive('make_environment')
  345. command = module.make_info_command(
  346. repository_path='repo',
  347. config={
  348. 'archive_name_format': 'bar-{now}',
  349. 'match_archives': 'sh:foo-*',
  350. },
  351. local_borg_version='2.3.4',
  352. global_arguments=flexmock(),
  353. info_arguments=flexmock(archive=None, json=False, prefix=None, match_archives=None),
  354. local_path='borg',
  355. remote_path=None,
  356. )
  357. assert command == ('borg', 'info', '--match-archives', 'sh:foo-*', '--repo', 'repo')
  358. def test_make_info_command_with_match_archives_flag_passes_through_to_command():
  359. flexmock(module.flags).should_receive('make_flags').and_return(())
  360. flexmock(module.flags).should_receive('make_match_archives_flags').with_args(
  361. 'sh:foo-*',
  362. 'bar-{now}',
  363. '2.3.4',
  364. ).and_return(('--match-archives', 'sh:foo-*'))
  365. flexmock(module.flags).should_receive('make_flags_from_arguments').and_return(())
  366. flexmock(module.flags).should_receive('make_repository_flags').and_return(('--repo', 'repo'))
  367. flexmock(module.environment).should_receive('make_environment')
  368. command = module.make_info_command(
  369. repository_path='repo',
  370. config={'archive_name_format': 'bar-{now}', 'match_archives': 'sh:foo-*'},
  371. local_borg_version='2.3.4',
  372. global_arguments=flexmock(),
  373. info_arguments=flexmock(archive=None, json=False, prefix=None, match_archives='sh:foo-*'),
  374. local_path='borg',
  375. remote_path=None,
  376. )
  377. assert command == ('borg', 'info', '--match-archives', 'sh:foo-*', '--repo', 'repo')
  378. @pytest.mark.parametrize('argument_name', ('sort_by', 'first', 'last'))
  379. def test_make_info_command_passes_arguments_through_to_command(argument_name):
  380. flag_name = f"--{argument_name.replace('_', ' ')}"
  381. flexmock(module.flags).should_receive('make_flags').and_return(())
  382. flexmock(module.flags).should_receive('make_match_archives_flags').with_args(
  383. None,
  384. None,
  385. '2.3.4',
  386. ).and_return(())
  387. flexmock(module.flags).should_receive('make_flags_from_arguments').and_return(
  388. (flag_name, 'value'),
  389. )
  390. flexmock(module.flags).should_receive('make_repository_flags').and_return(('--repo', 'repo'))
  391. flexmock(module.environment).should_receive('make_environment')
  392. command = module.make_info_command(
  393. repository_path='repo',
  394. config={},
  395. local_borg_version='2.3.4',
  396. global_arguments=flexmock(),
  397. info_arguments=flexmock(
  398. archive=None,
  399. json=False,
  400. prefix=None,
  401. match_archives=None,
  402. **{argument_name: 'value'},
  403. ),
  404. local_path='borg',
  405. remote_path=None,
  406. )
  407. assert command == ('borg', 'info', flag_name, 'value', '--repo', 'repo')
  408. def test_make_info_command_with_date_based_matching_passes_through_to_command():
  409. flexmock(module.flags).should_receive('make_flags').and_return(())
  410. flexmock(module.flags).should_receive('make_match_archives_flags').with_args(
  411. None,
  412. None,
  413. '2.3.4',
  414. ).and_return(())
  415. flexmock(module.flags).should_receive('make_flags_from_arguments').and_return(
  416. ('--newer', '1d', '--newest', '1y', '--older', '1m', '--oldest', '1w'),
  417. )
  418. flexmock(module.flags).should_receive('make_repository_flags').and_return(('--repo', 'repo'))
  419. info_arguments = flexmock(
  420. archive=None,
  421. json=False,
  422. prefix=None,
  423. match_archives=None,
  424. newer='1d',
  425. newest='1y',
  426. older='1m',
  427. oldest='1w',
  428. )
  429. command = module.make_info_command(
  430. repository_path='repo',
  431. config={},
  432. local_borg_version='2.3.4',
  433. global_arguments=flexmock(),
  434. info_arguments=info_arguments,
  435. local_path='borg',
  436. remote_path=None,
  437. )
  438. assert command == (
  439. 'borg',
  440. 'info',
  441. '--newer',
  442. '1d',
  443. '--newest',
  444. '1y',
  445. '--older',
  446. '1m',
  447. '--oldest',
  448. '1w',
  449. '--repo',
  450. 'repo',
  451. )
  452. def test_display_archives_info_calls_two_commands():
  453. flexmock(module.borgmatic.logger).should_receive('add_custom_log_levels')
  454. flexmock(module).should_receive('make_info_command')
  455. flexmock(module.environment).should_receive('make_environment')
  456. flexmock(module.borgmatic.config.paths).should_receive('get_working_directory').and_return(None)
  457. flexmock(module).should_receive('execute_command_and_capture_output').once()
  458. flexmock(module.flags).should_receive('warn_for_aggressive_archive_flags')
  459. flexmock(module).should_receive('execute_command').once()
  460. module.display_archives_info(
  461. repository_path='repo',
  462. config={},
  463. local_borg_version='2.3.4',
  464. global_arguments=flexmock(),
  465. info_arguments=flexmock(archive=None, json=False, prefix=None, match_archives=None),
  466. )
  467. def test_display_archives_info_with_json_calls_json_command_only():
  468. flexmock(module.borgmatic.logger).should_receive('add_custom_log_levels')
  469. flexmock(module).should_receive('make_info_command')
  470. flexmock(module.environment).should_receive('make_environment')
  471. flexmock(module.borgmatic.config.paths).should_receive('get_working_directory').and_return(None)
  472. json_output = flexmock()
  473. flexmock(module).should_receive('execute_command_and_capture_output').and_return(json_output)
  474. flexmock(module.flags).should_receive('warn_for_aggressive_archive_flags').never()
  475. flexmock(module).should_receive('execute_command').never()
  476. assert (
  477. module.display_archives_info(
  478. repository_path='repo',
  479. config={},
  480. local_borg_version='2.3.4',
  481. global_arguments=flexmock(),
  482. info_arguments=flexmock(archive=None, json=True, prefix=None, match_archives=None),
  483. )
  484. == json_output
  485. )
  486. def test_display_archives_info_calls_borg_with_working_directory():
  487. flexmock(module.borgmatic.logger).should_receive('add_custom_log_levels')
  488. flexmock(module).should_receive('make_info_command')
  489. flexmock(module.environment).should_receive('make_environment')
  490. flexmock(module.borgmatic.config.paths).should_receive('get_working_directory').and_return(
  491. '/working/dir',
  492. )
  493. flexmock(module).should_receive('execute_command_and_capture_output').with_args(
  494. full_command=object,
  495. environment=object,
  496. working_directory='/working/dir',
  497. borg_local_path=object,
  498. borg_exit_codes=object,
  499. ).once()
  500. flexmock(module.flags).should_receive('warn_for_aggressive_archive_flags')
  501. flexmock(module).should_receive('execute_command').with_args(
  502. full_command=object,
  503. output_log_level=object,
  504. environment=object,
  505. working_directory='/working/dir',
  506. borg_local_path=object,
  507. borg_exit_codes=object,
  508. ).once()
  509. module.display_archives_info(
  510. repository_path='repo',
  511. config={'working_directory': '/working/dir'},
  512. local_borg_version='2.3.4',
  513. global_arguments=flexmock(),
  514. info_arguments=flexmock(archive=None, json=False, prefix=None, match_archives=None),
  515. )