6👍
Try using the DRF extended test client:
from rest_framework import status
from rest_framework.test import APITestCase, APIClient
class CategoryTests(APITestCase):
client = APIClient()
def test_create_create(self):
url = '/category/add/'
data = {"name":"Sports","description":"get live updates here"}
response = self.client.post(url, data, format='json')
self.assertEquals(response.data, data)
1👍
Issue was with url, I correct it and it worked. So my url was actually
url = '/v1.0/category/add/'
👤Neo
- [Django]-Caught DoesNotExist while rendering: Photo matching query does not exist
- [Django]-How to use RelatedFieldWidgetWrapper in django 3
Source:stackexchange.com