def test_pull_request_tag_event(self, pagure_pr_tag_added): centos_event_parser = CentosEventParser() event_object = centos_event_parser.parse_event(pagure_pr_tag_added) assert isinstance(event_object, PullRequestLabelPagureEvent) assert event_object.pr_id == 18 assert event_object.base_repo_namespace == "source-git" assert event_object.base_repo_name == "packit-hello-world" assert event_object.base_repo_owner == "packit" assert event_object.base_ref == "master" assert event_object.labels == {"accepted"} assert (event_object.project_url == "https://git.stg.centos.org/source-git/packit-hello-world") assert isinstance(event_object.project, PagureProject) assert event_object.project.full_repo_name == "source-git/packit-hello-world" assert isinstance(event_object.base_project, PagureProject) assert (event_object.base_project.full_repo_name == "fork/packit/source-git/packit-hello-world") flexmock(PackageConfigGetter).should_receive( "get_package_config_from_repo").with_args( base_project=event_object.base_project, project=event_object.project, pr_id=18, reference="0ec7f861383821218c485a45810d384ca224e357", fail_when_missing=False, spec_file_path="SPECS/packit-hello-world.spec", ).and_return(flexmock()).once() flexmock(PagureProject).should_receive("get_web_url").and_return( "https://git.stg.centos.org/source-git/packit-hello-world") assert event_object.package_config
def test_pull_request_comment_event(self, pagure_pr_comment_added): centos_event_parser = CentosEventParser() event_object = centos_event_parser.parse_event(pagure_pr_comment_added) assert isinstance(event_object, PullRequestCommentPagureEvent) assert event_object.pr_id == 16 assert event_object.base_repo_namespace == "source-git" assert event_object.base_repo_name == "packit-hello-world" assert event_object.base_repo_owner == "sakalosj" assert event_object.base_ref is None assert event_object.target_repo == "packit-hello-world" assert event_object.commit_sha == "dfe787d04101728c6ddc213d3f4bf39c969f194c" assert event_object.user_login == "sakalosj" assert event_object.comment == "/packit copr-build" assert (event_object.project_url == "https://git.stg.centos.org/source-git/packit-hello-world") assert isinstance(event_object.project, PagureProject) assert event_object.project.full_repo_name == "source-git/packit-hello-world" assert isinstance(event_object.base_project, PagureProject) assert (event_object.base_project.full_repo_name == "fork/sakalosj/source-git/packit-hello-world") flexmock(PackageConfigGetter).should_receive( "get_package_config_from_repo").with_args( base_project=event_object.base_project, project=event_object.project, pr_id=16, reference="dfe787d04101728c6ddc213d3f4bf39c969f194c", fail_when_missing=False, spec_file_path="SPECS/packit-hello-world.spec", ).and_return(flexmock()).once() flexmock(PagureProject).should_receive("get_web_url").and_return( "https://git.stg.centos.org/source-git/packit-hello-world") assert event_object.package_config
def test_update_pull_request_event(self, pagure_pr_update): centos_event_parser = CentosEventParser() event_object = centos_event_parser.parse_event(pagure_pr_update) assert isinstance(event_object, PullRequestPagureEvent) assert event_object.action == PullRequestAction.synchronize assert event_object.pr_id == 13 assert event_object.base_repo_namespace == "source-git" assert event_object.base_repo_name == "packit-hello-world" assert event_object.base_repo_owner == "sakalosj" assert event_object.base_ref == "master" assert event_object.target_repo == "packit-hello-world" assert event_object.commit_sha == "b658af51df98c1cbf74a75095ced920bba2ef25e" assert event_object.user_login == "sakalosj" assert event_object.identifier == "13" assert (event_object.project_url == "https://git.stg.centos.org/source-git/packit-hello-world") assert isinstance(event_object.project, PagureProject) assert event_object.project.full_repo_name == "source-git/packit-hello-world" assert isinstance(event_object.base_project, PagureProject) assert (event_object.base_project.full_repo_name == "fork/sakalosj/source-git/packit-hello-world") flexmock(PackageConfigGetter).should_receive( "get_package_config_from_repo").with_args( base_project=event_object.base_project, project=event_object.project, pr_id=13, reference="b658af51df98c1cbf74a75095ced920bba2ef25e", fail_when_missing=False, spec_file_path="SPECS/packit-hello-world.spec", ).and_return(flexmock()).once() flexmock(PagureProject).should_receive("get_web_url").and_return( "https://git.stg.centos.org/source-git/packit-hello-world") assert event_object.package_config
def test_new_pull_request_event(self, pagure_pr_new): centos_event_parser = CentosEventParser() event_object = centos_event_parser.parse_event(pagure_pr_new) assert isinstance(event_object, PullRequestPagureEvent) assert event_object.action == PullRequestAction.opened assert event_object.pr_id == 12 assert event_object.base_repo_namespace == "source-git" assert event_object.base_repo_name == "packit-hello-world" assert event_object.base_repo_owner == "sakalosj" assert event_object.base_ref == "master" assert event_object.target_repo == "packit-hello-world" assert event_object.commit_sha == "bf9701dea5a167caa7a1afa0759342aa0bf0d8fd" assert event_object.user_login == "sakalosj" assert event_object.identifier == "12" assert (event_object.project_url == "https://git.stg.centos.org/source-git/packit-hello-world") assert isinstance(event_object.project, PagureProject) assert event_object.project.full_repo_name == "source-git/packit-hello-world" assert isinstance(event_object.base_project, PagureProject) assert (event_object.base_project.full_repo_name == "fork/sakalosj/source-git/packit-hello-world") flexmock(PackageConfigGetter).should_receive( "get_package_config_from_repo").with_args( base_project=event_object.base_project, project=event_object.project, pr_id=12, reference="bf9701dea5a167caa7a1afa0759342aa0bf0d8fd", fail_when_missing=False, spec_file_path="SPECS/packit-hello-world.spec", ).and_return(flexmock()).once() flexmock(PagureProject).should_receive("get_web_url").and_return( "https://git.stg.centos.org/source-git/packit-hello-world") assert event_object.package_config