def test_approve__no_tier(self): """ If there's no tier object, we should get a 404. """ video = self.create_video(status=Video.UNAPPROVED) request = self.factory.get('/', {'video_id': video.pk}, user=self.user) with mock.patch('mirocommunity_saas.admin.livesearch_views.' 'LiveSearchApproveVideoView.get') as get: with self.assertRaises(Http404): approve(request) self.assertFalse(get.called)
def test_approve__below_limit(self): """ If limit hasn't been reached, the underlying view should be called. """ tier = self.create_tier(video_limit=100) self.create_tier_info(tier) video = self.create_video(status=Video.UNAPPROVED) request = self.factory.get('/', {'video_id': video.pk}, user=self.user) with mock.patch('mirocommunity_saas.admin.livesearch_views.' 'LiveSearchApproveVideoView.get') as get: approve(request) self.assertTrue(get.called)