A wrapper script for Borg backup software that creates and prunes backups
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
787B

  1. import logging
  2. from flexmock import flexmock
  3. from borgmatic import verbosity as module
  4. def insert_logging_mock(log_level):
  5. '''
  6. Mock the isEnabledFor from Python logging.
  7. '''
  8. logging = flexmock(module.logging.Logger)
  9. logging.should_receive('isEnabledFor').replace_with(lambda level: level >= log_level)
  10. logging.should_receive('getEffectiveLevel').replace_with(lambda: log_level)
  11. def test_verbosity_to_log_level_maps_known_verbosity_to_log_level():
  12. assert module.verbosity_to_log_level(module.VERBOSITY_SOME) == logging.INFO
  13. assert module.verbosity_to_log_level(module.VERBOSITY_LOTS) == logging.DEBUG
  14. def test_verbosity_to_log_level_maps_unknown_verbosity_to_warning_level():
  15. assert module.verbosity_to_log_level('my pants') == logging.WARNING