示例#1
0
 class Meta:
     resource_name = 'fim'
     queryset = Fim.objects.all()
     authorization = Authorization()
示例#2
0
 class Meta:
     queryset = CoconutEco.objects.all()
     authentication = Authentication()
     authorization = Authorization()
示例#3
0
 class Meta:
     resource_name = 'edge_bundle'
     allowed_methods = ('get',)
     detail_uri_name = 'name'
     authorization = Authorization()
     authentication = Authentication()
示例#4
0
from tastypie.resources import ModelResource
from narratives.models import ICMJSON
from tastypie.authorization import Authorization
authorization = Authorization()


class NarrativeResource(ModelResource):
    class Meta:
        queryset = ICMJSON.objects.all()
        resource_name = 'icmjson'
示例#5
0
 class Meta:
     authorization = Authorization()
     queryset = APNSDevice.objects.all()
     resource_name = "device/apns"
示例#6
0
 class Meta:
     always_return_data = True
     authorization = Authorization()
     queryset = AppStore.objects.all()
示例#7
0
 class Meta:
   queryset = Address.objects.all()
   authorization = Authorization()
   resource_name = 'address'
示例#8
0
 class Meta(object):
     authorization = Authorization()
     serializer = Serializer()
     object_class = dict
示例#9
0
 class Meta(object):
     authorization = Authorization()
     throttle = BaseThrottle()
示例#10
0
 class Meta:
     queryset = Employee.objects.all()
     resource_name = 'custom_employee'
     authentication = BasicAuthentication()
     authorization = Authorization()
     serializer = Serializer(formats=['json', 'plist'])
示例#11
0
 class Meta:
     queryset = Connection.objects.all()
     allowed_methods = ['get', 'post']
     authentication = Authentication()
     authorization = Authorization()
示例#12
0
 class Meta:
     queryset = User.objects.all()
     resource_name = 'user'
     authorization = Authorization()
示例#13
0
 class Meta:
     queryset = Category.objects.all()
     authorization = Authorization()
     resource_name = 'category'
     filtering = {'user': ALL_WITH_RELATIONS, 'lists': ALL_WITH_RELATIONS}
示例#14
0
 class Meta:
     resource_name = 'inicio'
     queryset = Inicio.objects.all()
     authorization = Authorization()
示例#15
0
 class Meta:
     queryset = Menu.objects.all()
     resource_name = 'menu'
     allowed_methods = ['get', 'post', 'patch']
     authorization = Authorization()
示例#16
0
 class Meta:
     queryset      = Note.objects.all()
     resource_name = 'note'
     authorization = Authorization()
     fields        = ['title', 'body']
示例#17
0
 class Meta:
     queryset = Order.objects.all()
     resource_name = 'order'
     allowed_methods = ['get', 'post', 'patch', 'put']
     authorization = Authorization()
示例#18
0
 class Meta:
     queryset = Face.objects.all()
     authorization = Authorization()
     list_allowed_methods = ['get', 'post']
     detail_allowed_methods = ['get']
示例#19
0
 class Meta:
   queryset = RealEstate.objects.all()
   authorization = Authorization()
   resource_name = 'real_estate'
   excludes = ("approved")
   always_return_data = True
示例#20
0
 class Meta:
     queryset = Environment.objects.all()
     resource_name = 'environment'
     authorization= Authorization()
示例#21
0
 class Meta:
     queryset = Note.objects.all()
     resource_name = 'note'
     authorization = Authorization()
示例#22
0
 class Meta:
     queryset = Raid.objects.all()
     resource_name = 'raid'
     authorization = Authorization()
示例#23
0
 class Meta:
     authorization = Authorization()
     queryset = GCMDevice.objects.all()
     resource_name = "device/gcm"
示例#24
0
 class Meta:
     queryset = GameNight.objects.all()
     resource_name = 'game night'
     authorization = Authorization()
示例#25
0
 class Meta:
     authorization = Authorization()  # insecure as all heck
     queryset = Employee.objects.all()
     resource_name = 'employee'
     fields = ['dept', 'last_name', 'first_name', 'created_at', 'unique_id']
示例#26
0
 class Meta:
     collection_name = "data"
     queryset = Users.objects.all()
     resource_name = 'users'
     authorization = Authorization()
示例#27
0
 class Meta:
     resource_name = 'country'
     list_allowed_methods = ('get',)
     detail_allowed_methods = []
     authorization = Authorization()
     authentication = Authentication()
示例#28
0
 class Meta:
     queryset = ExpenseCategory.objects.all()
     resource_name = 'expensecategory'
     authorization = Authorization()
示例#29
0
 class Meta:
     queryset = Playlist.objects.all()
     resource_name = 'playlist'
     authorization = Authorization(
     )  #note: INSECURE - for demo purposes only
示例#30
0
from django.contrib.auth import get_user_model
from django.contrib.auth.models import Group
from django.core.urlresolvers import reverse
from mock import patch
from model_mommy import mommy
from tastypie.authorization import Authorization
from tastypie.authentication import Authentication
from tastypie.test import ResourceTestCase


@patch('api.v1.cis.users.UsersResource._meta.authentication', Authentication())
@patch('api.v1.cis.users.UsersResource._meta.authorization', Authorization())
class Test(ResourceTestCase):
    def test_set_groups(self):
        obj = mommy.make(get_user_model())
        group = mommy.make(Group)
        detail_url = reverse('api_dispatch_detail',
                             kwargs={
                                 'resource_name': 'users',
                                 'pk': obj.pk
                             })
        group_detail_url = reverse('api_dispatch_detail',
                                   kwargs={
                                       'resource_name': 'groups',
                                       'pk': group.pk
                                   })

        data = {
            'groups': [group_detail_url],
        }
        resp = self.api_client.put(detail_url, data=data)