test_command.py 982 B

123456789101112131415161718192021222324252627282930313233
  1. from flexmock import flexmock
  2. from atticmatic import command as module
  3. def test_load_backend_with_atticmatic_command_should_return_attic_backend():
  4. backend = flexmock()
  5. (
  6. flexmock(module).should_receive('import_module').with_args('atticmatic.backends.attic')
  7. .and_return(backend).once()
  8. )
  9. assert module.load_backend('atticmatic') == backend
  10. def test_load_backend_with_unknown_command_should_return_attic_backend():
  11. backend = flexmock()
  12. (
  13. flexmock(module).should_receive('import_module').with_args('atticmatic.backends.attic')
  14. .and_return(backend).once()
  15. )
  16. assert module.load_backend('unknownmatic') == backend
  17. def test_load_backend_with_borgmatic_command_should_return_borg_backend():
  18. backend = flexmock()
  19. (
  20. flexmock(module).should_receive('import_module').with_args('atticmatic.backends.borg')
  21. .and_return(backend).once()
  22. )
  23. assert module.load_backend('borgmatic') == backend