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


Python forms.ContractorDeliverableRevisionForm类代码示例

本文整理汇总了Python中default_documents.forms.ContractorDeliverableRevisionForm的典型用法代码示例。如果您正苦于以下问题:Python ContractorDeliverableRevisionForm类的具体用法?Python ContractorDeliverableRevisionForm怎么用?Python ContractorDeliverableRevisionForm使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: test_user_is_both_leader_and_approver

 def test_user_is_both_leader_and_approver(self):
     """A single user cannot appear twice in the same distribution list."""
     self.data.update({
         'leader': self.user.id,
         'approver': self.user.id
     })
     form = ContractorDeliverableRevisionForm(self.data, category=self.category)
     self.assertFalse(form.is_valid())
开发者ID:thibault,项目名称:phase,代码行数:8,代码来源:test_forms.py

示例2: test_reviewers_cannot_be_deleted_after_reviewers_step

 def test_reviewers_cannot_be_deleted_after_reviewers_step(self):
     self.rev.start_review()
     self.rev.end_reviewers_step()
     self.data.update({'reviewers': ''})
     form = ContractorDeliverableRevisionForm(
         self.data,
         instance=self.rev,
         category=self.category)
     self.assertFalse(form.is_valid())
     self.assertTrue('reviewers' in form.errors)
开发者ID:thibault,项目名称:phase,代码行数:10,代码来源:test_forms.py

示例3: test_approver_cannot_be_changed_after_approver_step

    def test_approver_cannot_be_changed_after_approver_step(self):
        self.rev.start_review()
        self.rev.end_review()
        self.data.update({'approver': self.user4.id})

        form = ContractorDeliverableRevisionForm(
            self.data,
            instance=self.rev,
            category=self.category)
        self.assertFalse(form.is_valid())
        self.assertTrue('approver' in form.errors)
开发者ID:thibault,项目名称:phase,代码行数:11,代码来源:test_forms.py

示例4: test_reviewers_cannot_be_added_after_reviewers_step

    def test_reviewers_cannot_be_added_after_reviewers_step(self):
        self.rev.start_review()
        self.rev.end_reviewers_step()

        reviewers = '{},{}'.format(self.user.id, self.user4.id)
        self.data.update({'reviewers': reviewers})

        form = ContractorDeliverableRevisionForm(
            self.data,
            instance=self.rev,
            category=self.category)
        self.assertFalse(form.is_valid())
        self.assertTrue('reviewers' in form.errors)
开发者ID:thibault,项目名称:phase,代码行数:13,代码来源:test_forms.py

示例5: test_removing_approver_before_approver_step_doesnt_end_review

    def test_removing_approver_before_approver_step_doesnt_end_review(self):
        self.rev.start_review()

        self.assertIsNone(self.rev.review_end_date)

        self.data.update({'approver': ''})
        form = ContractorDeliverableRevisionForm(
            self.data,
            instance=self.rev,
            category=self.category)
        rev = form.save()

        review = rev.get_review(self.user3)
        self.assertIsNone(review)

        self.assertIsNone(self.rev.review_end_date)
开发者ID:thibault,项目名称:phase,代码行数:16,代码来源:test_forms.py

示例6: test_update_approver_updates_distrib_list

    def test_update_approver_updates_distrib_list(self):
        self.rev.start_review()
        review = self.rev.get_review(self.user3)
        self.assertEqual(review.role, 'approver')

        self.data.update({'approver': self.user4.id})
        form = ContractorDeliverableRevisionForm(
            self.data,
            instance=self.rev,
            category=self.category)
        rev = form.save()

        review = rev.get_review(self.user3)
        self.assertIsNone(review)

        review = rev.get_review(self.user4)
        self.assertEqual(review.role, 'approver')
开发者ID:thibault,项目名称:phase,代码行数:17,代码来源:test_forms.py

示例7: test_reviewer_may_not_be_deleted_during_reviewers_step

    def test_reviewer_may_not_be_deleted_during_reviewers_step(self):
        """Reviewers that submitted a review cannot be removed."""
        self.rev.reviewers.add(self.user4)
        self.rev.start_review()

        # Post a review
        review = self.rev.get_review(self.user)
        review.post_review(comments=None)

        # Assert the reviewers stop is still open
        self.rev.refresh_from_db()
        self.assertIsNone(self.rev.reviewers_step_closed)

        # Try to remove the initial reviewer
        reviewers = str(self.user4.id)
        self.data.update({'reviewers': reviewers})
        form = ContractorDeliverableRevisionForm(
            self.data,
            instance=self.rev,
            category=self.category)
        self.assertFalse(form.is_valid())
        self.assertTrue('reviewers' in form.errors)
开发者ID:thibault,项目名称:phase,代码行数:22,代码来源:test_forms.py

示例8: test_reviewer_can_be_added_during_reviewers_step

    def test_reviewer_can_be_added_during_reviewers_step(self):
        self.rev.start_review()

        # Count initial Reviews
        qs = Review.objects \
            .filter(document=self.rev.document) \
            .filter(revision=self.rev.revision) \
            .filter(role='reviewer')
        self.assertEqual(qs.count(), 1)

        # Add a reviewer
        reviewers = '{},{}'.format(self.user.id, self.user4.id)
        self.data.update({'reviewers': reviewers})
        form = ContractorDeliverableRevisionForm(
            self.data,
            instance=self.rev,
            category=self.category)
        self.assertTrue(form.is_valid())
        form.save()

        # Count updated Reviews
        self.assertEqual(qs.count(), 2)
开发者ID:thibault,项目名称:phase,代码行数:22,代码来源:test_forms.py

示例9: test_reviewer_may_be_deleted_during_reviewers_step

    def test_reviewer_may_be_deleted_during_reviewers_step(self):
        """A reviewer can be deleted if they didn't submit a review yet."""
        self.rev.start_review()

        # Count initial Reviews
        qs = Review.objects \
            .filter(document=self.rev.document) \
            .filter(revision=self.rev.revision) \
            .filter(role='reviewer')
        self.assertEqual(qs.count(), 1)

        # Remove a reviewer
        reviewers = ''
        self.data.update({'reviewers': reviewers})
        form = ContractorDeliverableRevisionForm(
            self.data,
            instance=self.rev,
            category=self.category)
        self.assertTrue(form.is_valid())
        form.save()

        # Count updated Reviews
        self.assertEqual(qs.count(), 0)
开发者ID:thibault,项目名称:phase,代码行数:23,代码来源:test_forms.py

示例10: test_removing_reviewers_can_end_reviewers_step

    def test_removing_reviewers_can_end_reviewers_step(self):
        """Remove all reviewers, and the review goes up to leader step."""
        self.rev.reviewers.add(self.user4)
        self.rev.start_review()

        leader_review = self.rev.get_review(self.user2)
        self.assertEqual(leader_review.status, 'pending')

        # Count Review objects
        qs = Review.objects \
            .filter(document=self.rev.document) \
            .filter(revision=self.rev.revision) \
            .filter(role='reviewer')
        self.assertEqual(qs.count(), 2)

        # Remove one reviewer
        self.data.update({'reviewers': str(self.user.id)})
        form = ContractorDeliverableRevisionForm(
            self.data,
            instance=self.rev,
            category=self.category)
        self.assertTrue(form.is_valid())
        form.save()

        # Assert the reviewers step is still open
        self.rev.refresh_from_db()
        self.assertIsNone(self.rev.reviewers_step_closed)
        self.assertEqual(qs.count(), 1)

        # Remove second reviewer
        self.data.update({'reviewers': ''})
        form = ContractorDeliverableRevisionForm(
            self.data,
            instance=self.rev,
            category=self.category)
        self.assertTrue(form.is_valid())
        form.save()

        # Assert the reviewers step is closed
        self.rev.refresh_from_db()
        self.assertEqual(qs.count(), 0)
        self.assertIsNotNone(self.rev.reviewers_step_closed)

        leader_review.refresh_from_db()
        self.assertEqual(leader_review.status, 'progress')
开发者ID:thibault,项目名称:phase,代码行数:45,代码来源:test_forms.py

示例11: test_review_form_is_valid

 def test_review_form_is_valid(self):
     form = ContractorDeliverableRevisionForm(self.data, category=self.category)
     self.assertTrue(form.is_valid())
开发者ID:thibault,项目名称:phase,代码行数:3,代码来源:test_forms.py


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