test_compact.py 941 B

12345678910111213141516171819202122232425262728
  1. from flexmock import flexmock
  2. from borgmatic.actions import compact as module
  3. def test_compact_actions_calls_hooks_for_configured_repository():
  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').once()
  7. compact_arguments = flexmock(
  8. repository=None,
  9. progress=flexmock(),
  10. cleanup_commits=flexmock(),
  11. compact_threshold=flexmock(),
  12. )
  13. global_arguments = flexmock(monitoring_verbosity=1, dry_run=False)
  14. module.run_compact(
  15. config_filename='test.yaml',
  16. repository={'path': 'repo'},
  17. config={},
  18. local_borg_version=None,
  19. compact_arguments=compact_arguments,
  20. global_arguments=global_arguments,
  21. dry_run_label='',
  22. local_path=None,
  23. remote_path=None,
  24. )