def test_projects_list(mock_request): mock_client = CoprClient.create_from_file_config(config_location) mock_request.return_value = make_mock_response("projects_list.200.json") test_resp = mock_client.get_projects_list() assert len(test_resp.projects_list) == 1 test_project = test_resp.projects_list[0] assert test_project.projectname == "perl516-el7" assert test_project.description == "Test description"
def test_projects_list(mock_request): mock_client = CoprClient.create_from_file_config(config_location) mock_request.return_value = make_mock_response("projects_list.200.json") test_resp = mock_client.get_projects_list() assert len(test_resp.projects_list) == 1 test_project = test_resp.projects_list[0] assert test_project.projectname == "perl516-el7" assert test_project.description == "Test description"
def __init__(self): try: self.client = CoprClient.create_from_file_config() except (copr_exceptions.CoprNoConfException, copr_exceptions.CoprConfigException): print(no_config_warning) self.client = CoprClient(copr_url=u"http://copr.fedoraproject.org", no_config=True)
def __init__(self, config): self.config = config try: self.client = CoprClient.create_from_file_config(config) except (copr_exceptions.CoprNoConfException, copr_exceptions.CoprConfigException): print(no_config_warning.format(config or "~/.config/copr")) self.client = CoprClient( copr_url=u"http://copr.fedoraproject.org", no_config=True )
def test_get_build_status(mock_request): mock_client = CoprClient.create_from_file_config(config_location) mock_request.return_value = make_mock_response("build_details.200.json") test_resp = mock_client.get_build_details(27382) assert test_resp.status == "succeeded" assert test_resp.project == "atomic-next" assert test_resp.built_pkgs == [u'golang-github-stretchr-objx-devel 0'] assert test_resp.submitted_on == 1408031345
def __init__(self, config): self.config = config try: self.client = CoprClient.create_from_file_config(config) except (copr_exceptions.CoprNoConfException, copr_exceptions.CoprConfigException): sys.stderr.write(no_config_warning.format(config or "~/.config/copr")) self.client = CoprClient( copr_url=u"http://copr.fedoraproject.org", no_config=True )
def __init__(self): try: self.client = CoprClient.create_from_file_config() except (copr_exceptions.CoprNoConfException, copr_exceptions.CoprConfigException): print(no_config_warning) self.client = CoprClient( copr_url=u"http://copr.fedoraproject.org", no_config=True )
def test_get_build_status(mock_request): mock_client = CoprClient.create_from_file_config(config_location) mock_request.return_value = make_mock_response("build_details.200.json") test_resp = mock_client.get_build_details(27382) assert test_resp.status == "succeeded" assert test_resp.project == "atomic-next" assert test_resp.built_pkgs == [u'golang-github-stretchr-objx-devel 0'] assert test_resp.submitted_on == 1408031345
def test_get_build_config(mock_request): mock_client = CoprClient.create_from_file_config(config_location) mock_request.return_value = make_mock_response("build_config.200.json") test_resp = mock_client.get_build_config("project", "chroot") assert 'additional_packages' in test_resp.data expected_args = [ "additional_packages", "additional_repos", "chroot", "enable_net", "repos", "use_bootstrap_container", "with_opts", "without_opts" ] for arg in expected_args: assert arg in test_resp.data test_resp.data.pop(arg) assert not test_resp.data.keys()
distsuffix = '' tag = args[0] pkgstoignore = [] if config.has_section(tag) and config.has_option(tag, 'blacklist'): pkgstoignore = config.get(tag, 'blacklist').split(' ') disttag = config.get(tag, 'disttag').split() if tag.startswith('satellite'): tag = tag + '-candidate' if opts.copr: from copr import CoprClient buildsystem = 'copr' owner, project = tag.split('/', 2) myclient = CoprClient.create_from_file_config() result = myclient.get_packages_list(ownername=owner, projectname=project, with_latest_build=True, with_latest_succeeded_build=True) rpmlist = [] for pkg in result.packages_list: pkg_name = pkg.data['name'] pkg_succeeded = pkg.data['latest_succeeded_build'] if pkg_succeeded: pkg_version = pkg_succeeded['pkg_version'] else: # packages inherited from forked repo has no latest_succeeded_build pkg_latest = pkg.data['latest_build'] if pkg_latest and pkg_latest['state'] == "forked": pkg_version = pkg_latest['pkg_version']
import subprocess import argparse import time import os from copr import create_client2_from_params from copr import CoprClient import json URL_PATTERN = 'https://pypi.python.org/pypi/{package}/json' CONFIG = os.path.join(os.path.expanduser("~"), ".config/copr") COPR_URL = "https://copr.fedorainfracloud.org/" USER = "******" COPR = "PyPI2" cl = CoprClient.create_from_file_config(CONFIG) parser = argparse.ArgumentParser(prog = "pypi") parser.add_argument("-s", "--submit-pypi-modules", dest="submit_pypi_modules", metavar='PYTHON_VERSION', action="store") parser.add_argument("-u", "--submit-unbuilt-pypi-modules", dest="submit_unbuilt_pypi_modules", metavar='PYTHON_VERSION', action="store") parser.add_argument("-p", "--parse-succeeded-packages", dest="parse_succeeded_packages", action="store_true") parser.add_argument("-o", "--parse-succeeded-packages-v1client", dest="parse_succeeded_packages_v1client", action="store_true") args = parser.parse_args() def create_package_name(module_name): return "python-{}".format(module_name.replace(".", "-")) #NOT USED def get_version(package, url_pattern=URL_PATTERN):
def test_list_projects(): CoprClient.create_from_file_config(config_location)
def test_client_from_config(): cl = CoprClient.create_from_file_config(config_location) assert isinstance(cl, CoprClient) assert cl.login == "api-login" assert cl.token == "api-token" assert cl.username == "user_name"
distsuffix = '' tag = args[0] pkgstoignore = [] if config.has_section(tag) and config.has_option(tag, 'blacklist'): pkgstoignore = config.get(tag, 'blacklist').split(' ') disttag = config.get(tag, 'disttag').split() if tag.startswith('satellite'): tag = tag + '-candidate' if opts.copr: from copr import CoprClient buildsystem='copr' owner, project = tag.split('/',2) myclient = CoprClient.create_from_file_config() result = myclient.get_packages_list(ownername=owner, projectname=project, with_latest_build=True, with_latest_succeeded_build=True) rpmlist = [] for pkg in result.packages_list: pkg_name = pkg.data['name'] pkg_succeeded = pkg.data['latest_succeeded_build'] if pkg_succeeded: pkg_version = pkg_succeeded['pkg_version'] else: # packages inherited from forked repo has no latest_succeeded_build pkg_latest = pkg.data['latest_build'] if pkg_latest and pkg_latest['state'] == "forked": pkg_version = pkg_latest['pkg_version'] else:
def test_list_projects(mock_request): mock_client = CoprClient.create_from_file_config(config_location)
def test_client_from_config(): cl = CoprClient.create_from_file_config(config_location) assert isinstance(cl, CoprClient) assert cl.login == "api-login" assert cl.token == "api-token" assert cl.username == "user_name"
def test_list_projects(): CoprClient.create_from_file_config(config_location)