Exemplo n.º 1
0
def do_repo_create(config):
    """Test if creating repositories works."""
    args = ['-c', config, 'repo', 'create']
    main(args)
    state = SystemStateReader()
    state.read()
    call_output([
        'aptly', 'repo', 'add', 'centrify', 'vagrant/hellome_0.1-1_amd64.deb'
    ])
    assert set(['centrify']) == state.repos
Exemplo n.º 2
0
def test_call_output_error():
    """Test if call_output raises errors correctly"""
    args = [
        'bash',
        '-c',
        'exit 42',
    ]
    error = False
    try:
        call_output(args)
    except subprocess.CalledProcessError as e:
        assert e.returncode == 42
        error = True
    assert error
Exemplo n.º 3
0
def do_repo_create(config):
    """Test if creating repositories works."""
    args = [
        '-c',
        config,
        'repo',
        'create'
    ]
    main(args)
    state = SystemStateReader()
    state.read()
    call_output([
        'aptly',
        'repo',
        'add',
        'centrify',
        'vagrant/hellome_0.1-1_amd64.deb'
    ])
    assert set(['centrify']) == state.repos
Exemplo n.º 4
0
def execute_and_parse_show_cmd(args):
    """Executes and parses a aptly show command.

    :param args: Command to execute
    :type  args: list
    """
    result = {}
    show, _ = pyaptly.call_output(args)
    for line in show.split('\n'):
        if ":" in line:
            key, value = line.split(":", 1)
            key = key.lower()
            result[key] = value.strip()
    return result
Exemplo n.º 5
0
def execute_and_parse_show_cmd(args):
    """Executes and parses a aptly show command.

    :param args: Command to execute
    :type  args: list
    """
    result = {}
    show, _ = pyaptly.call_output(args)
    for line in show.split('\n'):
        if ":" in line:
            key, value = line.split(":", 1)
            key = key.lower()
            result[key] = value.strip()
    return result
Exemplo n.º 6
0
def test_snapshot_create_filter():
    """Test if snapshot filter create works."""
    with test.clean_and_config(
            os.path.join(
                _test_base,
                b"snapshot_filter.yml",
            )) as (tyml, config):
        do_snapshot_create(config)
        data, _ = call_output([
            'aptly', 'snapshot', 'search', 'filterfake01-20121010T0000Z',
            'Name (% *)'
        ])
        state = [x.strip() for x in data.split('\n') if x]
        expect = ['libhello_0.1-1_amd64']
        assert state == expect
Exemplo n.º 7
0
def test_snapshot_create_filter():
    """Test if snapshot filter create works."""
    with test.clean_and_config(os.path.join(
            _test_base,
            b"snapshot_filter.yml",
    )) as (tyml, config):
        do_snapshot_create(config)
        data, _ = call_output([
            'aptly',
            'snapshot',
            'search',
            'filterfake01-20121010T0000Z',
            'Name (% *)'
        ])
        state = [x.strip() for x in data.split('\n') if x]
        expect = ['libhello_0.1-1_amd64']
        assert state == expect