コード例 #1
0
    def test_above_limit(self):
        """
        If the limit isn't high enough, none of the videos should be approved.
        (The formset isn't valid.)

        """
        tier = self.create_tier(video_limit=2)
        self.create_tier_info(tier)

        for data in [self.approve_data, self.feature_data]:
            formset = VideoFormSet(data, queryset=Video.objects.all(),
                                   prefix=self.prefix)
            self.assertFalse(formset.is_valid())
コード例 #2
0
    def test_above_limit(self):
        """
        If the limit isn't high enough, none of the videos should be approved.
        (The formset isn't valid.)

        """
        tier = self.create_tier(video_limit=2)
        self.create_tier_info(tier)

        for data in [self.approve_data, self.feature_data]:
            formset = VideoFormSet(data,
                                   queryset=Video.objects.all(),
                                   prefix=self.prefix)
            self.assertFalse(formset.is_valid())
コード例 #3
0
    def test_below_limit(self):
        """
        If the limit is high enough, the videos should be approved.

        """
        tier = self.create_tier(video_limit=3)
        self.create_tier_info(tier)

        for data in [self.approve_data, self.feature_data]:
            formset = VideoFormSet(data, queryset=Video.objects.all(),
                                   prefix=self.prefix)
            self.assertTrue(formset.is_valid())
            self.assertTrue(all(form.instance.status == Video.ACTIVE
                                for form in formset.initial_forms))
コード例 #4
0
    def test_below_limit(self):
        """
        If the limit is high enough, the videos should be approved.

        """
        tier = self.create_tier(video_limit=3)
        self.create_tier_info(tier)

        for data in [self.approve_data, self.feature_data]:
            formset = VideoFormSet(data,
                                   queryset=Video.objects.all(),
                                   prefix=self.prefix)
            self.assertTrue(formset.is_valid())
            self.assertTrue(
                all(form.instance.status == Video.ACTIVE
                    for form in formset.initial_forms))