Пример #1
0
 def test_activity_with_rejected_presidency_review(self):
     """
     Test that an activity with only a rejected presidency review doesn't appear in
     Activity.objects.approved() nor Activity.objects.pending() but in Activity.objects.rejected()
     """
     self.p_review = self.activity.review_set.create(reviewer=self.user,
                                                     reviewer_club=get_presidency(),
                                                     is_approved=False)
     self.assertIn(self.p_review, self.activity.review_set.filter(reviewer_club=get_presidency()))
     self.assertNotIn(self.activity, Activity.objects.approved())
     self.assertIn(self.activity, Activity.objects.rejected())
     self.assertNotIn(self.activity, Activity.objects.pending())
Пример #2
0
 def test_activity_with_approved_presidency_review_and_no_dsa_review(self):
     """
     Test that an activity with only an approved presidency review doesn't appear in
     Activity.objects.approved() nor rejected but in pending.
     """
     self.p_review = self.activity.review_set.create(reviewer=self.user,
                                                     reviewer_club=get_presidency(),
                                                     is_approved=True)
     self.assertIn(self.p_review, self.activity.review_set.filter(reviewer_club=get_presidency()))
     self.assertQuerysetEqual(self.activity.review_set.filter(reviewer_club=get_deanship()),
                              Review.objects.none())
     self.assertNotIn(self.activity, Activity.objects.approved())
     self.assertNotIn(self.activity, Activity.objects.rejected())
     self.assertIn(self.activity, Activity.objects.pending())
Пример #3
0
 def test_activity_with_rejected_presidency_review(self):
     """
     Test that an activity with only a rejected presidency review doesn't appear in
     Activity.objects.approved() nor Activity.objects.pending() but in Activity.objects.rejected()
     """
     self.p_review = self.activity.review_set.create(
         reviewer=self.user,
         reviewer_club=get_presidency(),
         is_approved=False)
     self.assertIn(
         self.p_review,
         self.activity.review_set.filter(reviewer_club=get_presidency()))
     self.assertNotIn(self.activity, Activity.objects.approved())
     self.assertIn(self.activity, Activity.objects.rejected())
     self.assertNotIn(self.activity, Activity.objects.pending())
Пример #4
0
    def test_activity_with_rejected_presidency_review_and_approved_dsa_review(self):
        """
        Test that an activity with a rejected presidency review and approved DSA review
        doesn't appear in Activity.objects.approved()
        """
        self.p_review = self.activity.review_set.create(reviewer=self.user,
                                                        reviewer_club=get_presidency(),
                                                        is_approved=False)
        self.assertIn(self.p_review, self.activity.review_set.filter(reviewer_club=get_presidency()))

        self.d_review = self.activity.review_set.create(reviewer=self.user,
                                                        reviewer_club=get_deanship(),
                                                        is_approved=True)
        self.assertIn(self.d_review, self.activity.review_set.filter(reviewer_club=get_deanship()))
        self.assertNotIn(self.activity, Activity.objects.approved())
        self.assertIn(self.activity, Activity.objects.rejected())
        self.assertNotIn(self.activity, Activity.objects.pending())
Пример #5
0
 def test_activity_with_approved_presidency_review_and_no_dsa_review(self):
     """
     Test that an activity with only an approved presidency review doesn't appear in
     Activity.objects.approved() nor rejected but in pending.
     """
     self.p_review = self.activity.review_set.create(
         reviewer=self.user,
         reviewer_club=get_presidency(),
         is_approved=True)
     self.assertIn(
         self.p_review,
         self.activity.review_set.filter(reviewer_club=get_presidency()))
     self.assertQuerysetEqual(
         self.activity.review_set.filter(reviewer_club=get_deanship()),
         Review.objects.none())
     self.assertNotIn(self.activity, Activity.objects.approved())
     self.assertNotIn(self.activity, Activity.objects.rejected())
     self.assertIn(self.activity, Activity.objects.pending())
Пример #6
0
    def test_activity_with_approved_presidency_review_and_approved_dsa_review(self):
        """
        Test that an activity with an approved presidency review and an approved DSA review
        DOES appear in Activity.objects.approved() and DOES NOT appear in rejected or pending.
        This is the ONLY case in which the activity is considered to be approved.
        """
        self.p_review = self.activity.review_set.create(reviewer=self.user,
                                                        reviewer_club=get_presidency(),
                                                        is_approved=True)
        self.assertIn(self.p_review, self.activity.review_set.filter(reviewer_club=get_presidency()))

        self.d_review = self.activity.review_set.create(reviewer=self.user,
                                                        reviewer_club=get_deanship(),
                                                        is_approved=True)
        self.assertIn(self.d_review, self.activity.review_set.filter(reviewer_club=get_deanship()))
        self.assertIn(self.activity, Activity.objects.approved())
        self.assertNotIn(self.activity, Activity.objects.rejected())
        self.assertNotIn(self.activity, Activity.objects.pending())
Пример #7
0
    def test_activity_with_rejected_presidency_review_and_approved_dsa_review(
            self):
        """
        Test that an activity with a rejected presidency review and approved DSA review
        doesn't appear in Activity.objects.approved()
        """
        self.p_review = self.activity.review_set.create(
            reviewer=self.user,
            reviewer_club=get_presidency(),
            is_approved=False)
        self.assertIn(
            self.p_review,
            self.activity.review_set.filter(reviewer_club=get_presidency()))

        self.d_review = self.activity.review_set.create(
            reviewer=self.user, reviewer_club=get_deanship(), is_approved=True)
        self.assertIn(
            self.d_review,
            self.activity.review_set.filter(reviewer_club=get_deanship()))
        self.assertNotIn(self.activity, Activity.objects.approved())
        self.assertIn(self.activity, Activity.objects.rejected())
        self.assertNotIn(self.activity, Activity.objects.pending())
Пример #8
0
    def test_activity_with_approved_presidency_review_and_approved_dsa_review(
            self):
        """
        Test that an activity with an approved presidency review and an approved DSA review
        DOES appear in Activity.objects.approved() and DOES NOT appear in rejected or pending.
        This is the ONLY case in which the activity is considered to be approved.
        """
        self.p_review = self.activity.review_set.create(
            reviewer=self.user,
            reviewer_club=get_presidency(),
            is_approved=True)
        self.assertIn(
            self.p_review,
            self.activity.review_set.filter(reviewer_club=get_presidency()))

        self.d_review = self.activity.review_set.create(
            reviewer=self.user, reviewer_club=get_deanship(), is_approved=True)
        self.assertIn(
            self.d_review,
            self.activity.review_set.filter(reviewer_club=get_deanship()))
        self.assertIn(self.activity, Activity.objects.approved())
        self.assertNotIn(self.activity, Activity.objects.rejected())
        self.assertNotIn(self.activity, Activity.objects.pending())
Пример #9
0
 def test_list_view_with_presidency_member(self):
     add_club_member(get_presidency(), self.user)
     self.util_superuser_and_presidency()
Пример #10
0
 def test_list_view_with_presidency_coordinator(self):
     set_club_coordinator(get_presidency(), self.user)
     self.util_superuser_and_presidency()
Пример #11
0
 def test_list_view_with_presidency_member(self):
     add_club_member(get_presidency(), self.user)
     self.util_superuser_and_presidency()
Пример #12
0
 def test_list_view_with_presidency_coordinator(self):
     set_club_coordinator(get_presidency(), self.user)
     self.util_superuser_and_presidency()
Пример #13
0
def add_presidency_review(activity, status, reviewer=create_user()):
    activity.review_set.create(reviewer=reviewer,
                               reviewer_club=get_presidency(),
                               is_approved=status)
    return activity