2
0

test_compact.py 999 B

1234567891011121314151617181920212223242526272829
  1. from flexmock import flexmock
  2. from borgmatic.actions import compact as module
  3. def test_compact_actions_calls_hooks():
  4. flexmock(module.logger).answer = lambda message: None
  5. flexmock(module.borgmatic.borg.feature).should_receive('available').and_return(True)
  6. flexmock(module.borgmatic.borg.compact).should_receive('compact_segments')
  7. flexmock(module.borgmatic.hooks.command).should_receive('execute_hook').times(2)
  8. compact_arguments = flexmock(
  9. progress=flexmock(), cleanup_commits=flexmock(), threshold=flexmock()
  10. )
  11. global_arguments = flexmock(monitoring_verbosity=1, dry_run=False)
  12. module.run_compact(
  13. config_filename='test.yaml',
  14. repository='repo',
  15. storage={},
  16. retention={},
  17. hooks={},
  18. hook_context={},
  19. local_borg_version=None,
  20. compact_arguments=compact_arguments,
  21. global_arguments=global_arguments,
  22. dry_run_label='',
  23. local_path=None,
  24. remote_path=None,
  25. )