當前位置: 首頁>>代碼示例>>Python>>正文


Python ContractorDeliverableRevisionForm.save方法代碼示例

本文整理匯總了Python中default_documents.forms.ContractorDeliverableRevisionForm.save方法的典型用法代碼示例。如果您正苦於以下問題:Python ContractorDeliverableRevisionForm.save方法的具體用法?Python ContractorDeliverableRevisionForm.save怎麽用?Python ContractorDeliverableRevisionForm.save使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在default_documents.forms.ContractorDeliverableRevisionForm的用法示例。


在下文中一共展示了ContractorDeliverableRevisionForm.save方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_removing_reviewers_can_end_reviewers_step

# 需要導入模塊: from default_documents.forms import ContractorDeliverableRevisionForm [as 別名]
# 或者: from default_documents.forms.ContractorDeliverableRevisionForm import save [as 別名]
    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,代碼行數:47,代碼來源:test_forms.py

示例2: test_reviewer_can_be_added_during_reviewers_step

# 需要導入模塊: from default_documents.forms import ContractorDeliverableRevisionForm [as 別名]
# 或者: from default_documents.forms.ContractorDeliverableRevisionForm import save [as 別名]
    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,代碼行數:24,代碼來源:test_forms.py

示例3: test_reviewer_may_be_deleted_during_reviewers_step

# 需要導入模塊: from default_documents.forms import ContractorDeliverableRevisionForm [as 別名]
# 或者: from default_documents.forms.ContractorDeliverableRevisionForm import save [as 別名]
    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,代碼行數:25,代碼來源:test_forms.py

示例4: test_removing_approver_before_approver_step_doesnt_end_review

# 需要導入模塊: from default_documents.forms import ContractorDeliverableRevisionForm [as 別名]
# 或者: from default_documents.forms.ContractorDeliverableRevisionForm import save [as 別名]
    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,代碼行數:18,代碼來源:test_forms.py

示例5: test_update_approver_updates_distrib_list

# 需要導入模塊: from default_documents.forms import ContractorDeliverableRevisionForm [as 別名]
# 或者: from default_documents.forms.ContractorDeliverableRevisionForm import save [as 別名]
    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,代碼行數:19,代碼來源:test_forms.py


注:本文中的default_documents.forms.ContractorDeliverableRevisionForm.save方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。