Example #1
0
    def setUp(self):
        self.github_token = os.environ.get("GITHUB_TOKEN")
        self.github_user = os.environ.get("GITHUB_USER")
        self.pagure_token = os.environ.get("PAGURE_TOKEN")
        self.pagure_user = os.environ.get("PAGURE_USER")

        test_name = self.id() or "all"

        persistent_data_file = os.path.join(
            PERSISTENT_DATA_PREFIX, f"test_factory_data_{test_name}.yaml"
        )
        PersistentObjectStorage().storage_file = persistent_data_file

        if PersistentObjectStorage().is_write_mode and (
            not self.github_user or not self.github_token
        ):
            raise EnvironmentError("please set GITHUB_TOKEN GITHUB_USER env variables")

        if PersistentObjectStorage().is_write_mode and (
            not self.pagure_user or not self.pagure_token
        ):
            raise EnvironmentError("please set PAGURE_TOKEN PAGURE_USER env variables")

        self.github_service = GithubService(token=self.github_token)
        self.pagure_service = PagureService(token=self.pagure_token)
Example #2
0
    def setUp(self):
        self.token = os.environ.get("GITHUB_TOKEN")
        self.user = os.environ.get("GITHUB_USER")
        test_name = self.id() or "all"

        persistent_data_file = os.path.join(
            PERSISTENT_DATA_PREFIX, f"test_github_data_{test_name}.yaml")
        PersistentObjectStorage().storage_file = persistent_data_file

        if PersistentObjectStorage().is_write_mode and (not self.user
                                                        or not self.token):
            raise EnvironmentError(
                "please set GITHUB_TOKEN GITHUB_USER env variables")

        self.service = GithubService(token=self.token)

        self.ogr_project = self.service.get_project(namespace="packit-service",
                                                    repo="ogr")

        self.ogr_fork = self.service.get_project(namespace="packit-service",
                                                 repo="ogr",
                                                 is_fork=True)

        self.hello_world_project = self.service.get_project(
            namespace="packit-service", repo="hello-world")

        self.not_forked_project = self.service.get_project(
            namespace="fedora-modularity", repo="fed-to-brew")
Example #3
0
    def setUp(self):
        self.token = os.environ.get("PAGURE_TOKEN")
        self.user = os.environ.get("PAGURE_USER")
        test_name = self.id() or "all"

        persistent_data_file = os.path.join(
            PERSISTENT_DATA_PREFIX, f"test_pagure_data_{test_name}.yaml")

        PersistentObjectStorage().storage_file = persistent_data_file

        if PersistentObjectStorage().is_write_mode and (not self.user
                                                        or not self.token):
            raise EnvironmentError(
                "please set PAGURE_TOKEN PAGURE_USER env variables")

        self.service = PagureService(token=self.token)
        self.docker_py_project = self.service.get_project(
            namespace="rpms",
            repo="python-docker",
            username="******")
        self.abiword_project = self.service.get_project(namespace="rpms",
                                                        repo="abiword",
                                                        username="******")
        self.abiword_fork = self.service.get_project(namespace="rpms",
                                                     repo="abiword",
                                                     username="******",
                                                     is_fork=True)

        self.service_pagure = PagureService(token=self.token,
                                            instance_url="https://pagure.io")
        self.ogr_test_project = self.service_pagure.get_project(
            namespace=None, repo="ogr-test", username="******")
Example #4
0
    def setUp(self):
        self.token = os.environ.get("GITHUB_TOKEN")
        test_name = self.id() or "all"

        persistent_data_file = os.path.join(
            PERSISTENT_DATA_PREFIX, f"test_github_data_{test_name}.yaml")
        PersistentObjectStorage().storage_file = persistent_data_file

        if PersistentObjectStorage().is_write_mode and (not self.token):
            raise EnvironmentError("please set GITHUB_TOKEN env variables")

        self.service = GithubService(token=self.token)
        self._ogr_project = None
        self._ogr_fork = None
        self._hello_world_project = None
        self._not_forked_project = None
Example #5
0
    def setUp(self):
        self.token = os.environ.get("GITHUB_TOKEN")
        self.user = os.environ.get("GITHUB_USER")
        test_name = self.id() or "all"
        persistent_data_file = os.path.join(
            PERSISTENT_DATA_PREFIX, f"test_github_data_{test_name}.yaml")
        PersistentObjectStorage().storage_file = persistent_data_file
        if PersistentObjectStorage().is_write_mode and (not self.user
                                                        or not self.token):
            raise EnvironmentError(
                "please set GITHUB_TOKEN GITHUB_USER env variables")

        self.service = GithubService(token=self.token, read_only=True)

        self.colin_project = self.service.get_project(namespace="user-cont",
                                                      repo="colin")
Example #6
0
    def setUp(self):
        self.token = os.environ.get("PAGURE_TOKEN")
        test_name = self.id() or "all"

        self.persistent_data_file = os.path.join(
            PERSISTENT_DATA_PREFIX, f"test_pagure_data_{test_name}.yaml"
        )

        PersistentObjectStorage().storage_file = self.persistent_data_file

        if PersistentObjectStorage().is_write_mode and (not self.token):
            raise EnvironmentError("please set PAGURE_TOKEN env variables")

        self.service = PagureService(token=self.token, instance_url="https://pagure.io")
        self._user = None
        self._ogr_project = None
        self._ogr_fork = None
Example #7
0
    def setUp(self):
        self.github_app_id = os.environ.get("GITHUB_APP_ID")
        self.github_app_private_key_path = os.environ.get(
            "GITHUB_APP_PRIVATE_KEY_PATH")

        test_name = self.id() or "all"

        persistent_data_file = os.path.join(
            PERSISTENT_DATA_PREFIX, f"test_github-app_data_{test_name}.yaml")
        PersistentObjectStorage().storage_file = persistent_data_file

        if PersistentObjectStorage().is_write_mode and (
                not self.github_app_id
                or not self.github_app_private_key_path):
            raise EnvironmentError(
                "please set GITHUB_APP_ID GITHUB_APP_PRIVATE_KEY_PATH env variables"
            )
Example #8
0
    def setUp(self):
        self.conf = self.get_test_config()
        response_file = self.get_datafile_filename()
        PersistentObjectStorage().storage_file = response_file
        PersistentObjectStorage().dump_after_store = True

        self.project_ogr = self.conf.get_project(
            url="https://github.com/packit-service/ogr")

        self.pc = get_package_config_from_repo(
            sourcegit_project=self.project_ogr, ref="master")
        if not self.pc:
            raise RuntimeError("Package config not found.")
        self.dg = packit.distgit.DistGit(self.conf, self.pc)
        self.lp = LocalProject(git_project=self.project_ogr)
        self.upstream = packit.upstream.Upstream(self.conf,
                                                 self.pc,
                                                 local_project=self.lp)
Example #9
0
    def setUp(self):
        self.token = os.environ.get("GITLAB_TOKEN")
        self.user = os.environ.get("GITLAB_USER")
        test_name = self.id() or "all"

        persistent_data_file = os.path.join(
            PERSISTENT_DATA_PREFIX, f"test_gitlab_data_{test_name}.yaml")
        PersistentObjectStorage().storage_file = persistent_data_file

        if PersistentObjectStorage().is_write_mode and (not self.user
                                                        or not self.token):
            raise EnvironmentError(
                "please set GITLAB_TOKEN GITLAB_USER env variables")
        elif not self.token:
            self.token = "some_token"

        self.service = GitlabService(token=self.token,
                                     instance_url="https://gitlab.com",
                                     ssl_verify=True)

        self.project = self.service.get_project(repo="ogr-tests",
                                                namespace="packit-service")
Example #10
0
    def setUp(self):
        self.token = os.environ.get("PAGURE_TOKEN")
        self.user = os.environ.get("PAGURE_USER") or LAST_GENERATED_BY
        test_name = self.id() or "all"

        persistent_data_file = os.path.join(
            PERSISTENT_DATA_PREFIX, f"test_pagure_data_{test_name}.yaml")

        PersistentObjectStorage().storage_file = persistent_data_file

        if PersistentObjectStorage().is_write_mode and (not self.user
                                                        or not self.token):
            raise EnvironmentError(
                "please set PAGURE_TOKEN PAGURE_USER env variables")

        self.service = PagureService(token=self.token,
                                     instance_url="https://pagure.io")
        self.ogr_project = self.service.get_project(namespace=None,
                                                    repo="ogr-tests")
        self.ogr_fork = self.service.get_project(namespace=None,
                                                 repo="ogr-tests",
                                                 username=self.user,
                                                 is_fork=True)
Example #11
0
 def tearDown(self):
     PersistentObjectStorage().dump()