Ejemplo n.º 1
0
def record_git_module(
    _func=None,
    cassette: Optional[Cassette] = None,
):
    decorators = [
        (
            "git.repo.base.Repo.clone_from",
            StoreFiles.where_arg_references(
                key_position_params_dict={"to_path": 2},
                output_cls=Repo,
                cassette=cassette,
            ),
        ),
        (
            "git.remote.Remote.push",
            PushInfoStorageList.decorator_plain(),
        ),
        ("git.remote.Remote.fetch", FetchInfoStorageList.decorator_plain()),
        ("git.remote.Remote.pull", FetchInfoStorageList.decorator_plain()),
    ]
    record_git_decorator = replace_module_match_with_multiple_decorators(
        *decorators,
        cassette=cassette,
    )

    if _func is not None:
        return record_git_decorator(_func)
    else:
        return record_git_decorator
Ejemplo n.º 2
0
from requre.helpers.git.pushinfo import PushInfoStorageList
from requre.helpers.git.fetchinfo import FetchInfoStorageList
from requre.helpers.git.repo import Repo

from packit.api import PackitAPI
from tests_recording.testbase import PackitTest


@record_requests_for_all_methods()
@apply_decorator_to_all_methods(
    replace_module_match(what="packit.utils.run_command_remote",
                         decorate=Simple.decorator_plain()))
@apply_decorator_to_all_methods(
    replace_module_match(
        what="packit.fedpkg.FedPKG.clone",
        decorate=StoreFiles.where_arg_references(
            key_position_params_dict={"target_path": 2}),
    ))
@apply_decorator_to_all_methods(
    replace_module_match(
        what="git.repo.base.Repo.clone_from",
        decorate=StoreFiles.where_arg_references(
            key_position_params_dict={"to_path": 2},
            return_decorator=Repo.decorator_plain,
        ),
    ))
@apply_decorator_to_all_methods(
    replace_module_match(what="git.remote.Remote.push",
                         decorate=PushInfoStorageList.decorator_plain()))
@apply_decorator_to_all_methods(
    replace_module_match(what="git.remote.Remote.fetch",
                         decorate=FetchInfoStorageList.decorator_plain()))
Ejemplo n.º 3
0
    record_requests_module,
    record_tempfile_module,
    record_git_module,
)


@record_tempfile_module
@record_requests_module
@record_git_module
@apply_decorator_to_all_methods(
    replace_module_match(what="packit.utils.run_command_remote",
                         decorate=Simple.decorator_plain()))
@apply_decorator_to_all_methods(
    replace_module_match(
        what="packit.pkgtool.PkgTool.clone",
        decorate=StoreFiles.where_arg_references(
            key_position_params_dict={"target_path": 2}),
    ))
@apply_decorator_to_all_methods(
    replace_module_match(what="copr.v3.helpers.config_from_file",
                         decorate=Simple.decorator_plain()))
class ProposeUpdate(PackitTest):
    def cassette_setup(self, cassette):
        cassette.data_miner.data_type = DataTypes.Dict

    def setUp(self):
        super().setUp()
        self.configure_git()
        self._api = None

    @property
    def api(self):