test_cronitor.py 820 B

123456789101112131415161718192021222324
  1. from flexmock import flexmock
  2. from borgmatic.hooks import cronitor as module
  3. def test_ping_cronitor_hits_ping_url():
  4. ping_url = 'https://example.com'
  5. append = 'failed-so-hard'
  6. flexmock(module.requests).should_receive('get').with_args('{}/{}'.format(ping_url, append))
  7. module.ping_cronitor(ping_url, 'config.yaml', dry_run=False, append=append)
  8. def test_ping_cronitor_without_ping_url_does_not_raise():
  9. flexmock(module.requests).should_receive('get').never()
  10. module.ping_cronitor(ping_url=None, config_filename='config.yaml', dry_run=False, append='oops')
  11. def test_ping_cronitor_dry_run_does_not_hit_ping_url():
  12. ping_url = 'https://example.com'
  13. flexmock(module.requests).should_receive('get').never()
  14. module.ping_cronitor(ping_url, 'config.yaml', dry_run=True, append='yay')