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


Python BuildsLogic.delete_build方法代码示例

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


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

示例1: test_delete_build_basic

# 需要导入模块: from coprs.logic.builds_logic import BuildsLogic [as 别名]
# 或者: from coprs.logic.builds_logic.BuildsLogic import delete_build [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.builds_logic import BuildsLogic [as 别名]
# 或者: from coprs.logic.builds_logic.BuildsLogic import delete_build [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.builds_logic import BuildsLogic [as 别名]
# 或者: from coprs.logic.builds_logic.BuildsLogic import delete_build [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_delete_build_exceptions

# 需要导入模块: from coprs.logic.builds_logic import BuildsLogic [as 别名]
# 或者: from coprs.logic.builds_logic.BuildsLogic import delete_build [as 别名]
    def test_delete_build_exceptions(
            self, f_users, f_coprs, f_mock_chroots, f_builds, f_db):
        self.db.session.commit()
        with pytest.raises(InsufficientRightsException):
            BuildsLogic.delete_build(self.u1, self.b4)

        self.b1_bc[0].status = "running"
        self.db.session.add(self.b1_bc[0])
        self.db.session.commit()
        with pytest.raises(ActionInProgressException):
            BuildsLogic.delete_build(self.u1, self.b1)
开发者ID:1dot75cm,项目名称:Copr,代码行数:13,代码来源:test_builds_logic.py

示例5: test_delete_build_exceptions

# 需要导入模块: from coprs.logic.builds_logic import BuildsLogic [as 别名]
# 或者: from coprs.logic.builds_logic.BuildsLogic import delete_build [as 别名]
    def test_delete_build_exceptions(
            self, f_users, f_coprs, f_mock_chroots, f_builds, f_db):
        for bc in self.b4_bc:
            bc.status = StatusEnum("succeeded")
            bc.ended_on = time.time()
        self.u1.admin = False

        self.db.session.add_all(self.b4_bc)
        self.db.session.add(self.b4)
        self.db.session.add(self.u1)
        self.db.session.commit()
        with pytest.raises(InsufficientRightsException):
            BuildsLogic.delete_build(self.u1, self.b4)

        self.b1_bc[0].status = StatusEnum("running")
        self.db.session.add(self.b1_bc[0])
        self.db.session.commit()
        with pytest.raises(ActionInProgressException):
            BuildsLogic.delete_build(self.u1, self.b1)
开发者ID:0-T-0,项目名称:copr,代码行数:21,代码来源:test_builds_logic.py

示例6: test_delete_build_basic

# 需要导入模块: from coprs.logic.builds_logic import BuildsLogic [as 别名]
# 或者: from coprs.logic.builds_logic.BuildsLogic import delete_build [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_delete_build_bad_src_pkg

# 需要导入模块: from coprs.logic.builds_logic import BuildsLogic [as 别名]
# 或者: from coprs.logic.builds_logic.BuildsLogic import delete_build [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

示例8: test_delete_build_some_chroots

# 需要导入模块: from coprs.logic.builds_logic import BuildsLogic [as 别名]
# 或者: from coprs.logic.builds_logic.BuildsLogic import delete_build [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.builds_logic.BuildsLogic.delete_build方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。