예제 #1
0
def test_check_archives_without_any_checks_should_bail():
    consistency_config = flexmock().should_receive('get').and_return(None).mock
    flexmock(module).should_receive('_parse_checks').and_return(())
    insert_subprocess_never()

    module.check_archives(
        verbosity=None,
        repository='repo',
        consistency_config=consistency_config,
        command='attic',
    )
예제 #2
0
def test_check_archives_with_verbosity_lots_should_call_attic_with_verbose_parameter():
    consistency_config = flexmock().should_receive('get').and_return(None).mock
    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(
        verbosity=VERBOSITY_LOTS,
        repository='repo',
        consistency_config=consistency_config,
        command='attic',
    )
예제 #3
0
def test_check_archives_should_call_attic_with_parameters():
    checks = flexmock()
    check_last = flexmock()
    consistency_config = flexmock().should_receive('get').and_return(check_last).mock
    flexmock(module).should_receive('_parse_checks').and_return(checks)
    flexmock(module).should_receive('_make_check_flags').with_args(checks, check_last).and_return(())
    stdout = flexmock()
    insert_subprocess_mock(
        ('attic', 'check', 'repo'),
        stdout=stdout,
    )
    insert_platform_mock()
    insert_datetime_mock()
    builtins_mock().should_receive('open').and_return(stdout)
    flexmock(module.os).should_receive('devnull')

    module.check_archives(
        verbosity=None,
        repository='repo',
        consistency_config=consistency_config,
        command='attic',
    )