예제 #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, ''))
예제 #4
0
 def test_not_switch_flag(self):
     ok_(not switch("foo")().has_permission(self.request, ""))
예제 #5
0
 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, ''))