Esempio n. 1
0
class UpsellViewSet(CreateModelMixin, DestroyModelMixin, RetrieveModelMixin,
                    UpdateModelMixin, GenericViewSet):
    permission_classes = (
        switch('allow-b2g-paid-submission'),
        UpsellPermission,
    )
    queryset = AddonUpsell.objects.filter()
    serializer_class = UpsellSerializer

    def pre_save(self, obj):
        if not UpsellPermission().check(self.request, obj.free, obj.premium):
            raise PermissionDenied('Not allowed to alter that object')
Esempio n. 2
0
 def test_not_switch_flag(self):
     ok_(not switch('foo')().has_permission(self.request, ''))
Esempio n. 3
0
 def test_waffle_switch(self):
     self.create_switch('foo')
     ok_(switch('foo')().has_permission(self.request, ''))
 def test_not_switch_flag(self):
     ok_(not switch("foo")().has_permission(self.request, ""))
 def test_waffle_switch(self):
     self.create_switch("foo")
     ok_(switch("foo")().has_permission(self.request, ""))
Esempio n. 6
0
 def test_not_switch_flag(self):
     ok_(not switch('foo')().has_permission(self.request, ''))
Esempio n. 7
0
 def test_waffle_switch(self):
     self.create_switch('foo')
     ok_(switch('foo')().has_permission(self.request, ''))