def test_over_limit(self): """ If we're already at the limit, none of the videos should be approved. """ tier = self.create_tier(video_limit=0) self.create_tier_info(tier) response = limit_import_approvals(self.active_set[0], self.active_set) self.assertEqual(response, {'status': -1})
def test_partially_over_limit(self): """ If approving the videos would put us over the limit (but we aren't over or at the limit yet) we should approve the earliest-submitted videos. """ tier = self.create_tier(video_limit=5) self.create_tier_info(tier) response = limit_import_approvals(self.active_set[0], self.active_set) self.assertEqual(response, {'when_submitted__lt': self.active_set[5].when_submitted})
def test_at_limit(self): """ If approving the videos would leave us at the limit, then none of them should be filtered out. """ tier = self.create_tier(video_limit=10) self.create_tier_info(tier) # The sender is technically usually a SourceImport instance, but it's # only used for its database. response = limit_import_approvals(self.active_set[0], self.active_set) self.assertTrue(response is None)
def test_partially_over_limit(self): """ If approving the videos would put us over the limit (but we aren't over or at the limit yet) we should approve the earliest-submitted videos. """ tier = self.create_tier(video_limit=5) self.create_tier_info(tier) response = limit_import_approvals(self.active_set[0], self.active_set) self.assertEqual( response, {'when_submitted__lt': self.active_set[5].when_submitted})