def test_can_become_premium(self): self.addon.can_become_premium.return_value = True view = dec.can_become_premium(self.func) eq_(view(self.request, self.addon.pk, self.addon), True)
def test_cant_become_premium(self): self.addon.can_become_premium.return_value = False view = dec.can_become_premium(self.func) with self.assertRaises(PermissionDenied): view(self.request, self.addon.pk, self.addon)