本文整理汇总了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()
示例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()
示例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
示例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)
示例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)
示例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()
示例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()
示例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()