当前位置: 首页>>代码示例>>Python>>正文


Python ActionsLogic.get_many方法代码示例

本文整理汇总了Python中coprs.logic.actions_logic.ActionsLogic.get_many方法的典型用法代码示例。如果您正苦于以下问题:Python ActionsLogic.get_many方法的具体用法?Python ActionsLogic.get_many怎么用?Python ActionsLogic.get_many使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在coprs.logic.actions_logic.ActionsLogic的用法示例。


在下文中一共展示了ActionsLogic.get_many方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_delete_build_basic

# 需要导入模块: from coprs.logic.actions_logic import ActionsLogic [as 别名]
# 或者: from coprs.logic.actions_logic.ActionsLogic import get_many [as 别名]
    def test_delete_build_basic(
            self, f_users, f_coprs, f_mock_chroots, f_builds, f_db):

        self.b1.pkgs = "http://example.com/copr-keygen-1.58-1.fc20.src.rpm"
        expected_dir = self.b1.result_dir_name
        self.db.session.add(self.b1)
        self.db.session.commit()

        expected_chroots_to_delete = set()
        for bchroot in self.b1_bc:
            expected_chroots_to_delete.add(bchroot.name)

        assert len(ActionsLogic.get_many().all()) == 0
        BuildsLogic.delete_build(self.u1, self.b1)
        self.db.session.commit()

        assert len(ActionsLogic.get_many().all()) == 1
        action = ActionsLogic.get_many().one()
        delete_data = json.loads(action.data)
        assert "chroots" in delete_data
        assert delete_data["result_dir_name"] == expected_dir
        assert expected_chroots_to_delete == set(delete_data["chroots"])

        with pytest.raises(NoResultFound):
            BuildsLogic.get(self.b1.id).one()
开发者ID:0-T-0,项目名称:copr,代码行数:27,代码来源:test_builds_logic.py

示例2: test_delete_build_as_admin

# 需要导入模块: from coprs.logic.actions_logic import ActionsLogic [as 别名]
# 或者: from coprs.logic.actions_logic.ActionsLogic import get_many [as 别名]
    def test_delete_build_as_admin(
            self, f_users, f_coprs, f_mock_chroots, f_builds, f_db):

        self.b4.pkgs = "http://example.com/copr-keygen-1.58-1.fc20.src.rpm"
        expected_dir = self.b4.result_dir_name
        for bc in self.b4_bc:
            bc.status = StatusEnum("succeeded")
            bc.ended_on = time.time()

        self.u1.admin = True

        self.db.session.add_all(self.b4_bc)
        self.db.session.add(self.b4)
        self.db.session.add(self.u1)
        self.db.session.commit()

        expected_chroots_to_delete = set()
        for bchroot in self.b4_bc:
            expected_chroots_to_delete.add(bchroot.name)

        assert len(ActionsLogic.get_many().all()) == 0
        BuildsLogic.delete_build(self.u1, self.b4)
        self.db.session.commit()

        assert len(ActionsLogic.get_many().all()) == 1
        action = ActionsLogic.get_many().one()
        delete_data = json.loads(action.data)
        assert "chroots" in delete_data
        assert delete_data["result_dir_name"] == expected_dir
        assert expected_chroots_to_delete == set(delete_data["chroots"])

        with pytest.raises(NoResultFound):
            BuildsLogic.get(self.b4.id).one()
开发者ID:0-T-0,项目名称:copr,代码行数:35,代码来源:test_builds_logic.py

示例3: test_delete_build_no_chroots_to_clean

# 需要导入模块: from coprs.logic.actions_logic import ActionsLogic [as 别名]
# 或者: from coprs.logic.actions_logic.ActionsLogic import get_many [as 别名]
    def test_delete_build_no_chroots_to_clean(
            self, f_users, f_coprs, f_mock_chroots, f_builds, f_db):

        for bchroot in self.b1_bc:
            bchroot.status = helpers.StatusEnum("skipped")

        self.db.session.commit()
        assert len(ActionsLogic.get_many().all()) == 0
        BuildsLogic.delete_build(self.u1, self.b1)
        self.db.session.commit()
        assert len(ActionsLogic.get_many().all()) == 0
开发者ID:0-T-0,项目名称:copr,代码行数:13,代码来源:test_builds_logic.py

示例4: test_re_enable_auto_createrepo_produce_action

# 需要导入模块: from coprs.logic.actions_logic import ActionsLogic [as 别名]
# 或者: from coprs.logic.actions_logic.ActionsLogic import get_many [as 别名]
    def test_re_enable_auto_createrepo_produce_action(
            self, f_users, f_coprs, f_mock_chroots, f_db):

        self.db.session.add_all(
            [self.u1, self.c1, self.mc1, self.mc2, self.mc3])


        username = self.u1.name
        coprname = self.c1.name
        copr_id = self.c1.id
        chroot = self.mc1.name

        # 1.ensure ACR enabled

        self.db.session.commit()
        c1_actual = CoprsLogic.get(self.u1.name, self.c1.name).one()
        assert c1_actual.auto_createrepo
        # 1. disabling ACR
        self.test_client.post(
            "/coprs/{0}/{1}/update/".format(username, coprname),
            data={"name": coprname, chroot: "y", "id": copr_id,
                  "disable_createrepo": True},
            follow_redirects=True
        )
        self.db.session.commit()

        # check current status
        c1_actual = CoprsLogic.get(username, coprname).one()
        assert not c1_actual.auto_createrepo
        # no actions issued before
        assert len(ActionsLogic.get_many().all()) == 0

        # 2. enabling ACR
        self.test_client.post(
            "/coprs/{0}/{1}/update/".format(username, coprname),
            data={"name": coprname, chroot: "y", "id": copr_id,
                  "disable_createrepo": "false"},
            follow_redirects=True
        )
        self.db.session.commit()

        c1_actual = CoprsLogic.get(username, coprname).one()

        # ACR enabled
        assert c1_actual.auto_createrepo
        # added action
        assert len(ActionsLogic.get_many().all()) > 0
        action = ActionsLogic.get_many(action_type=ActionTypeEnum("createrepo")).one()

        data_dict = json.loads(action.data)
        assert data_dict["username"] == username
        assert data_dict["projectname"] == coprname
开发者ID:0-T-0,项目名称:copr,代码行数:54,代码来源:test_coprs_general.py

示例5: test_fork_copr_sends_actions

# 需要导入模块: from coprs.logic.actions_logic import ActionsLogic [as 别名]
# 或者: from coprs.logic.actions_logic.ActionsLogic import get_many [as 别名]
    def test_fork_copr_sends_actions(self, mc_flask_g, f_users, f_coprs, f_mock_chroots, f_builds, f_db):
        mc_flask_g.user.name = self.u2.name
        fc1, created = ComplexLogic.fork_copr(self.c1, self.u2, u"dstname")
        self.db.session.commit()

        actions = ActionsLogic.get_many(ActionTypeEnum("gen_gpg_key")).all()
        assert len(actions) == 1
        data = json.loads(actions[0].data)
        assert data["username"] == self.u2.name
        assert data["projectname"] == "dstname"

        actions = ActionsLogic.get_many(ActionTypeEnum("fork")).all()
        assert len(actions) == 1
        data = json.loads(actions[0].data)
        assert data["user"] == self.u2.name
        assert data["copr"] == "dstname"

        last_build, forked_build = self.c1.packages[0].builds[1], fc1.builds[0]
        assert data["builds_map"] == {str(forked_build.id): str(last_build.result_dir_name)}
开发者ID:RadimS97,项目名称:copr,代码行数:21,代码来源:test_complex_logic.py

示例6: test_delete_build_basic

# 需要导入模块: from coprs.logic.actions_logic import ActionsLogic [as 别名]
# 或者: from coprs.logic.actions_logic.ActionsLogic import get_many [as 别名]
    def test_delete_build_basic(
            self, f_users, f_coprs, f_mock_chroots, f_builds, f_db):
        self.db.session.commit()

        expected_chroots_to_delete = set()
        for bchroot in self.b1_bc:
            expected_chroots_to_delete.add(bchroot.name)

        assert len(ActionsLogic.get_many().all()) == 0
        BuildsLogic.delete_build(self.u1, self.b1)
        self.db.session.commit()

        assert len(ActionsLogic.get_many().all()) == 1
        action = ActionsLogic.get_many().one()
        delete_data = json.loads(action.data)
        assert "chroots" in delete_data
        assert expected_chroots_to_delete == set(delete_data["chroots"])

        with pytest.raises(NoResultFound):
            BuildsLogic.get(self.b1.id).one()
开发者ID:1dot75cm,项目名称:Copr,代码行数:22,代码来源:test_builds_logic.py

示例7: test_copr_logic_add_sends_create_gpg_key_action

# 需要导入模块: from coprs.logic.actions_logic import ActionsLogic [as 别名]
# 或者: from coprs.logic.actions_logic.ActionsLogic import get_many [as 别名]
    def test_copr_logic_add_sends_create_gpg_key_action(self, f_users, f_mock_chroots, f_db):
        name = u"project_1"
        selected_chroots = [self.mc1.name]

        CoprsLogic.add(self.u1, name, selected_chroots)
        self.db.session.commit()

        actions = ActionsLogic.get_many(ActionTypeEnum("gen_gpg_key")).all()
        assert len(actions) == 1
        data = json.loads(actions[0].data)
        assert data["username"] == self.u1.name
        assert data["projectname"] == name
开发者ID:danvratil,项目名称:copr,代码行数:14,代码来源:test_coprs_logic.py

示例8: test_delete_build_bad_src_pkg

# 需要导入模块: from coprs.logic.actions_logic import ActionsLogic [as 别名]
# 或者: from coprs.logic.actions_logic.ActionsLogic import get_many [as 别名]
    def test_delete_build_bad_src_pkg(
            self, f_users, f_coprs, f_mock_chroots, f_builds, f_db):

        # has meaning only for the builds with old result dir naming schema

        self.b1.pkgs = "http://example.com/"
        self.db.session.add(self.b1)
        self.db.session.commit()

        expected_chroots_to_delete = set()
        for bchroot in self.b1_bc:
            bchroot.git_hash = None
            expected_chroots_to_delete.add(bchroot.name)

        assert len(ActionsLogic.get_many().all()) == 0
        BuildsLogic.delete_build(self.u1, self.b1)
        self.db.session.commit()

        assert len(ActionsLogic.get_many().all()) == 0

        with pytest.raises(NoResultFound):
            BuildsLogic.get(self.b1.id).one()
开发者ID:0-T-0,项目名称:copr,代码行数:24,代码来源:test_builds_logic.py

示例9: test_delete_build_some_chroots

# 需要导入模块: from coprs.logic.actions_logic import ActionsLogic [as 别名]
# 或者: from coprs.logic.actions_logic.ActionsLogic import get_many [as 别名]
    def test_delete_build_some_chroots(
            self, f_users, f_coprs, f_mock_chroots, f_builds, f_db):

        expected_chroots_to_delete = set([self.b1_bc[0].name,
                                          self.b1_bc[-1].name])
        for bchroot in self.b1_bc[1:-1]:
            bchroot.status = helpers.StatusEnum("skipped")

        self.db.session.commit()

        assert len(ActionsLogic.get_many().all()) == 0
        BuildsLogic.delete_build(self.u1, self.b1)
        self.db.session.commit()

        assert len(ActionsLogic.get_many().all()) == 1
        action = ActionsLogic.get_many().one()
        delete_data = json.loads(action.data)
        assert "chroots" in delete_data
        assert expected_chroots_to_delete == set(delete_data["chroots"])

        with pytest.raises(NoResultFound):
            BuildsLogic.get(self.b1.id).one()
开发者ID:1dot75cm,项目名称:Copr,代码行数:24,代码来源:test_builds_logic.py


注:本文中的coprs.logic.actions_logic.ActionsLogic.get_many方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。