Exemplo 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')
Exemplo n.º 2
0
 def test_not_switch_flag(self):
     ok_(not switch('foo')().has_permission(self.request, ''))
Exemplo n.º 3
0
 def test_waffle_switch(self):
     self.create_switch('foo')
     ok_(switch('foo')().has_permission(self.request, ''))
Exemplo n.º 4
0
 def test_not_switch_flag(self):
     ok_(not switch("foo")().has_permission(self.request, ""))
Exemplo n.º 5
0
 def test_waffle_switch(self):
     self.create_switch("foo")
     ok_(switch("foo")().has_permission(self.request, ""))
Exemplo n.º 6
0
 def test_not_switch_flag(self):
     ok_(not switch('foo')().has_permission(self.request, ''))
Exemplo n.º 7
0
 def test_waffle_switch(self):
     self.create_switch('foo')
     ok_(switch('foo')().has_permission(self.request, ''))