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
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
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
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
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
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