示例#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')
示例#2
0
 def test_not_switch_flag(self):
     ok_(not switch('foo')().has_permission(self.request, ''))
示例#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, ""))
示例#6
0
 def test_not_switch_flag(self):
     ok_(not switch('foo')().has_permission(self.request, ''))
示例#7
0
 def test_waffle_switch(self):
     self.create_switch('foo')
     ok_(switch('foo')().has_permission(self.request, ''))