#776 [frontend] test that disabled chroot doesn't get removed in project edit
Merged 4 years ago by praiskup. Opened 4 years ago by frostyx.
copr/ frostyx/copr copr-chroots-updte-disabled  into  master

@@ -6,7 +6,7 @@ 

  from copr_common.enums import ActionTypeEnum

  from coprs import app

  from coprs.logic.actions_logic import ActionsLogic

- from coprs.logic.coprs_logic import CoprsLogic

+ from coprs.logic.coprs_logic import CoprsLogic, CoprChrootsLogic

  

  from coprs import models

  from coprs.whoosheers import CoprWhoosheer
@@ -79,3 +79,27 @@ 

          data = json.loads(actions[0].data)

          assert data["ownername"] == self.u1.name

          assert data["projectname"] == name

+ 

+ 

+ class TestCoprChrootsLogic(CoprsTestCase):

+ 

+     def test_update_from_names(self, f_users, f_coprs, f_mock_chroots, f_db):

+         chroot_names = ["fedora-17-x86_64", "fedora-17-i386"]

+         assert [ch.name for ch in self.c2.copr_chroots] == chroot_names

+         CoprChrootsLogic.update_from_names(self.c2.user, self.c2, chroot_names)

+         assert [ch.name for ch in self.c2.copr_chroots] == chroot_names

+ 

+         chroot_names = ["fedora-17-x86_64"]

+         CoprChrootsLogic.update_from_names(self.c2.user, self.c2, chroot_names)

+         assert [ch.name for ch in self.c2.copr_chroots] == chroot_names

+ 

+     def test_update_from_names_disabled(self, f_users, f_coprs, f_mock_chroots, f_db):

+         # Say, that fedora-17-x86_64 is outdated

+         self.mc2.is_active = False

+ 

+         # The fedora-17-x86_64 is not a part of the copr edit form,

+         # because it is outdated. See #712, PR#719

+         CoprChrootsLogic.update_from_names(self.c2.user, self.c2, ["fedora-17-i386"])

+ 

+         # However, it should not be removed from the Copr

+         assert [ch.name for ch in self.c2.copr_chroots] == ["fedora-17-x86_64", "fedora-17-i386"]

This tests, particularly test_update_from_names_disabled demonstrates, that the PR#719 was the correct fix to the #712 issue. If you revert the 3322f2a, that was added in the PR, the test fails.

rebased onto 073b154

4 years ago

Pull-Request has been merged by praiskup

4 years ago