Пример #1
0
    def test_pinned_projects(self, f_users, f_coprs, f_db):
        assert set(CoprsLogic.get_multiple_by_username(
            self.u2.name)) == {self.c2, self.c3}
        assert set(PinnedCoprsLogic.get_by_owner(self.u2)) == set()

        pc1 = models.PinnedCoprs(id=1,
                                 copr_id=self.c2.id,
                                 user_id=self.u2.id,
                                 position=1)
        pc2 = models.PinnedCoprs(id=2,
                                 copr_id=self.c3.id,
                                 user_id=self.u2.id,
                                 position=2)
        self.db.session.add_all([pc1, pc2])

        assert set(PinnedCoprsLogic.get_by_owner(self.u2)) == {pc1, pc2}
        assert set(CoprsLogic.get_multiple_by_username(
            self.u2.name)) == {self.c2, self.c3}
Пример #2
0
    def test_delete_project_that_is_pinned(self, f_users, f_coprs, f_db):
        pc1 = models.PinnedCoprs(id=1,
                                 copr_id=self.c2.id,
                                 user_id=self.u2.id,
                                 position=1)
        pc2 = models.PinnedCoprs(id=2,
                                 copr_id=self.c3.id,
                                 user_id=self.u2.id,
                                 position=2)
        self.db.session.add_all([pc1, pc2])

        ComplexLogic.delete_copr(self.c2, admin_action=True)
        assert set(CoprsLogic.get_multiple_by_username(
            self.u2.name)) == {self.c3}
        assert set(PinnedCoprsLogic.get_by_owner(self.u2)) == {pc2}