def test_lookup_publish_by_repos_using_Repo(config, monkeypatch, mocked_publish_list): monkeypatch.setattr(aptly_api.parts.publish.PublishAPISection, "list", mocked_publish_list) aptly = aptly_ctl.utils.ExtendedAptlyClient(config.url) l = aptly.lookup_publish_by_repos([ aptly_api.Repo("stretch_main", None, None, None), aptly_api.Repo("stretch_extra", None, None, None), ]) assert len(l) == 1 assert l[0] == publishes[0]
def tmp(class_self, reponame, query=None, with_deps=False, detailed=False): searched_repo = aptly_api.Repo(reponame, None, None, None) if searched_repo in pseudo_repo: if query is not None: all_packages = pseudo_repo[searched_repo] result = [p[0] for p in all_packages if query in p[1]] else: result = [p[0] for p in all_packages] else: raise aptly_api.AptlyAPIException( "404 - Not Found - local repo with name {} not found".format( reponame), status_code=404) return result
from .context import aptly_ctl from aptly_ctl.subcommands.search import rotate, search, config_subparser from aptly_ctl.utils import PackageRef import aptly_api from aptly_api import Package import argparse import pytest pseudo_repo = { aptly_api.Repo("stretch_main", None, None, None): [ ( Package("Pamd64 aptly 1.3.0+ds1-2 f7673868294f03c1", None, None, None), ["aptly"] # found by these queries ), (Package("Pamd64 python3.6 3.6.7-1 656e12e8d5fa96a0", None, None, None), ["python3.6", "Name (% python3*)", "Name (~ python3.*)"]) ], aptly_api.Repo("stretch_extra", None, None, None): [(Package("Pall python3-pip 9.0.1-2.3 52e9433afcb1e613", None, None, None), ["python3-pip", "Name (% python3*)", "Name (~ python3.*)"]), (Package("Pall python3-wheel 0.30.0-0.2 dca6d5ca7e3f5e6f", None, None, None), ["python3-wheel", "Name (% python3*)", "Name (~ python3.*)"])], aptly_api.Repo("stretch_nightly", None, None, None): [(Package("Pall python3-setuptools 40.5.0-1 4d5a70b19b984324", None, None, None), ["python3-setuptools", "Name (% python3*)", "Name (~ python3.*)"])] }
def _repo_show(class_self, reponame): return aptly_api.Repo("stretch_main", None, None, None)
def _repo_show(*args, **kwargs): return aptly_api.Repo("stretch_main", None, None, None)