2
0

test_check.py 1.0 KB

12345678910111213141516171819202122232425262728293031
  1. from flexmock import flexmock
  2. from borgmatic.actions import check as module
  3. def test_run_check_calls_hooks():
  4. flexmock(module.logger).answer = lambda message: None
  5. flexmock(module.borgmatic.config.checks).should_receive(
  6. 'repository_enabled_for_checks'
  7. ).and_return(True)
  8. flexmock(module.borgmatic.borg.check).should_receive('check_archives')
  9. flexmock(module.borgmatic.hooks.command).should_receive('execute_hook').times(2)
  10. check_arguments = flexmock(
  11. progress=flexmock(), repair=flexmock(), only=flexmock(), force=flexmock()
  12. )
  13. global_arguments = flexmock(monitoring_verbosity=1, dry_run=False)
  14. module.run_check(
  15. config_filename='test.yaml',
  16. repository='repo',
  17. location={'repositories': ['repo']},
  18. storage={},
  19. consistency={},
  20. hooks={},
  21. hook_context={},
  22. local_borg_version=None,
  23. check_arguments=check_arguments,
  24. global_arguments=global_arguments,
  25. local_path=None,
  26. remote_path=None,
  27. )