def test_check_archives_without_any_checks_should_bail(): consistency_config = flexmock() flexmock(module).should_receive('_parse_checks').and_return(()) insert_subprocess_never() module.check_archives( verbose=False, repository='repo', consistency_config=consistency_config, )
def main(): try: args = parse_arguments(*sys.argv[1:]) location_config, retention_config = parse_configuration(args.config_filename) repository = location_config['repository'] create_archive(args.excludes_filename, args.verbose, **location_config) prune_archives(args.verbose, repository, retention_config) check_archives(args.verbose, repository) except (ValueError, IOError, CalledProcessError) as error: print(error, file=sys.stderr) sys.exit(1)
def test_check_archives_with_verbose_should_call_attic_with_verbose_parameters( ): insert_subprocess_mock( ('attic', 'check', 'repo', '--verbose'), stdout=None, ) insert_platform_mock() insert_datetime_mock() module.check_archives( verbose=True, repository='repo', )
def main(): try: args = parse_arguments(*sys.argv[1:]) location_config, retention_config = parse_configuration( args.config_filename) repository = location_config['repository'] create_archive(args.excludes_filename, args.verbose, **location_config) prune_archives(args.verbose, repository, retention_config) check_archives(args.verbose, repository) except (ValueError, IOError, CalledProcessError) as error: print(error, file=sys.stderr) sys.exit(1)
def test_check_archives_should_call_attic_with_parameters(): stdout = flexmock() insert_subprocess_mock( ('attic', 'check', 'repo'), stdout=stdout, ) insert_platform_mock() insert_datetime_mock() flexmock(module).open = lambda filename, mode: stdout flexmock(module).os = flexmock().should_receive('devnull').mock module.check_archives( verbose=False, repository='repo', )
def test_check_archives_with_verbose_should_call_attic_with_verbose_parameters(): consistency_config = flexmock() flexmock(module).should_receive('_parse_checks').and_return(flexmock()) flexmock(module).should_receive('_make_check_flags').and_return(()) insert_subprocess_mock( ('attic', 'check', 'repo', '--verbose'), stdout=None, ) insert_platform_mock() insert_datetime_mock() module.check_archives( verbose=True, repository='repo', consistency_config=consistency_config, )
def test_check_archives_should_call_attic_with_parameters(): consistency_config = flexmock() flexmock(module).should_receive('_parse_checks').and_return(flexmock()) flexmock(module).should_receive('_make_check_flags').and_return(()) stdout = flexmock() insert_subprocess_mock( ('attic', 'check', 'repo'), stdout=stdout, ) insert_platform_mock() insert_datetime_mock() flexmock(module).open = lambda filename, mode: stdout flexmock(module).os = flexmock().should_receive('devnull').mock module.check_archives( verbose=False, repository='repo', consistency_config=consistency_config, )