示例#1
0
 def setUp(self):
     self.tag = TagFactory.create()
     self.view = TagViewSet.as_view({'get': 'retrieve'})
     self.anonymous_user = AnonymousUserFactory()
     factory = APIRequestFactory()
     url = reverse('api:v2:tag-detail', args=(self.tag.id,))
     self.request = factory.get(url)
示例#2
0
 def setUp(self):
     self.tag = TagFactory.create()
     self.view = TagViewSet.as_view({'get': 'retrieve'})
     self.anonymous_user = AnonymousUserFactory()
     factory = APIRequestFactory()
     url = reverse('api:v2:tag-detail', args=(self.tag.id,))
     self.request = factory.get(url)
示例#3
0
    def setUp(self):
        self.tags = TagFactory.create_batch(10)
        self.view = TagViewSet.as_view({'get': 'list'})
        self.anonymous_user = AnonymousUserFactory()

        factory = APIRequestFactory()
        url = reverse('api:v2:tag-list')
        self.request = factory.get(url)
示例#4
0
    def setUp(self):
        self.tags = TagFactory.create_batch(10)
        self.view = TagViewSet.as_view({'get': 'list'})
        self.anonymous_user = AnonymousUserFactory()

        factory = APIRequestFactory()
        url = reverse('api:v2:tag-list')
        self.request = factory.get(url)
示例#5
0
    def setUp(self):
        self.tag = TagFactory.create()
        self.anonymous_user = AnonymousUserFactory()
        self.user = UserFactory()
        self.staff_user = UserFactory(is_staff=True)

        factory = APIRequestFactory()
        url = reverse('api:v2:tag-detail', args=(self.tag.id,))
        self.request = factory.delete(url)

        self.view = TagViewSet.as_view({'delete': 'destroy'})
示例#6
0
    def setUp(self):
        self.tag = TagFactory.create()
        self.anonymous_user = AnonymousUserFactory()
        self.user = UserFactory()
        self.staff_user = UserFactory(is_staff=True)

        factory = APIRequestFactory()
        url = reverse('api:v2:tag-detail', args=(self.tag.id,))
        self.request = factory.delete(url)

        self.view = TagViewSet.as_view({'delete': 'destroy'})
示例#7
0
    def setUp(self):
        self.tag = TagFactory.build()
        self.anonymous_user = AnonymousUserFactory()
        self.user = UserFactory.create()
        self.staff_user = UserFactory.create(is_staff=True)

        self.factory = APIRequestFactory()
        self.url = reverse('api:v2:tag-list')
        self.request = self.factory.post(self.url, {
            'name': self.tag.name,
            'description': self.tag.description
        })

        self.view = TagViewSet.as_view({'post': 'create'})
示例#8
0
    def setUp(self):
        self.tag = TagFactory.build()
        self.anonymous_user = AnonymousUserFactory()
        self.user = UserFactory.create()
        self.staff_user = UserFactory.create(is_staff=True)

        self.factory = APIRequestFactory()
        self.url = reverse('api:v2:tag-list')
        self.request = self.factory.post(self.url, {
            'name': self.tag.name,
            'description': self.tag.description
        })

        self.view = TagViewSet.as_view({'post': 'create'})
示例#9
0
    def setUp(self):
        self.tags = TagFactory.create_batch(10)
        self.anonymous_user = AnonymousUserFactory()
        self.user = UserFactory()
        self.staff_user = UserFactory(is_staff=True)

        self.tag = TagFactory.create()
        self.unsaved_tag = TagFactory.build()
        self.updated_tag_data = {
            'name': 'new-tag-name',
            'description': 'new tag description'
        }

        self.factory = APIRequestFactory()

        self.create_view = TagViewSet.as_view({'post': 'create'})
        self.delete_view = TagViewSet.as_view({'delete': 'destroy'})
        self.detail_view = TagViewSet.as_view({'get': 'retrieve'})
        self.list_view = TagViewSet.as_view({'get': 'list'})
        self.update_view = TagViewSet.as_view({'put': 'update'})

        detail_url = reverse(self.url_route + '-detail', args=(self.tag.id, ))
        list_url = reverse(self.url_route + '-list')

        self.create_request = self.factory.post(
            list_url, {
                'name': self.unsaved_tag.name,
                'description': self.unsaved_tag.description
            })
        self.delete_request = self.factory.delete(detail_url)
        self.detail_request = self.factory.get(detail_url)
        self.list_request = self.factory.get(list_url)
        self.update_request = self.factory.put(
            detail_url, {
                'name': self.updated_tag_data['name'],
                'description': self.updated_tag_data['description']
            })
示例#10
0
    def setUp(self):
        self.tags = TagFactory.create_batch(10)
        self.anonymous_user = AnonymousUserFactory()
        self.user = UserFactory()
        self.staff_user = UserFactory(is_staff=True)

        self.tag = TagFactory.create()
        self.unsaved_tag = TagFactory.build()
        self.updated_tag_data = {
            'name': 'new-tag-name',
            'description': 'new tag description'
        }

        self.factory = APIRequestFactory()


        self.create_view = TagViewSet.as_view({'post': 'create'})
        self.delete_view = TagViewSet.as_view({'delete': 'destroy'})
        self.detail_view = TagViewSet.as_view({'get': 'retrieve'})
        self.list_view = TagViewSet.as_view({'get': 'list'})
        self.update_view = TagViewSet.as_view({'put': 'update'})

        detail_url = reverse(self.url_route + '-detail', args=(self.tag.id,))
        list_url = reverse(self.url_route + '-list')

        self.create_request = self.factory.post(list_url, {
            'name': self.unsaved_tag.name,
            'description': self.unsaved_tag.description
        })
        self.delete_request = self.factory.delete(detail_url)
        self.detail_request = self.factory.get(detail_url)
        self.list_request = self.factory.get(list_url)
        self.update_request = self.factory.put(detail_url, {
            'name': self.updated_tag_data['name'],
            'description': self.updated_tag_data['description']
        })
示例#11
0
    def setUp(self):
        self.tag = TagFactory.create()
        self.anonymous_user = AnonymousUserFactory()
        self.user = UserFactory.create()
        self.staff_user = UserFactory.create(is_staff=True)
        self.updated_tag_data = {
            'name': 'new-tag-name',
            'description': 'new tag description'
        }

        self.factory = APIRequestFactory()
        self.url = reverse('api:v2:tag-detail', args=(self.tag.id,))
        self.request = self.factory.put(self.url, {
            'name': self.updated_tag_data['name'],
            'description': self.updated_tag_data['description']
        })

        self.view = TagViewSet.as_view({'put': 'update'})
示例#12
0
    def setUp(self):
        self.tag = TagFactory.create()
        self.anonymous_user = AnonymousUserFactory()
        self.user = UserFactory.create()
        self.staff_user = UserFactory.create(is_staff=True)
        self.updated_tag_data = {
            'name': 'new-tag-name',
            'description': 'new tag description'
        }

        self.factory = APIRequestFactory()
        self.url = reverse('api:v2:tag-detail', args=(self.tag.id,))
        self.request = self.factory.put(self.url, {
            'name': self.updated_tag_data['name'],
            'description': self.updated_tag_data['description']
        })

        self.view = TagViewSet.as_view({'put': 'update'})